TL;DR
SFS (Smart Function Scheduler) is a novel user-space scheduler designed to fix the performance bottlenecks caused by the Linux kernel's default "fair" scheduling in serverless environments. By prioritizing short-lived functions through a two-level approach that approximates Shortest Remaining Time First (SRTF), SFS reduces function execution duration by nearly 50x for the majority of tasks with only a minor penalty for longer ones.
What Problem Does This Paper Address?
In serverless computing (Function-as-a-Service or FaaS), functions are often extremely short-lived, with many finishing in just a few milliseconds. However, cloud providers consolidate thousands of these functions onto single, high-core-count servers.
The authors identify a critical "last mile" efficiency gap: the default Linux Completely Fair Scheduler (CFS). CFS is designed for general-purpose fairness, giving every task a proportional slice of CPU time. While "fair" at the OS level, this is disastrous for FaaS. A 10ms function might be repeatedly context-switched and forced to wait in runqueues behind long-running tasks, leading to "turnaround time amplification" of over 50x. This not only hurts performance but also leads to overcharging, as users are often billed based on the total turnaround time rather than actual CPU usage.
Methods
SFS is implemented entirely in the user space, making it portable and easy to integrate with existing FaaS platforms like OpenLambda or OpenWhisk without requiring kernel modifications. Its core architecture consists of a two-level scheduling hierarchy:
- The FILTER Pool (Top Level): New function requests enter a global queue and are assigned to SFS workers. These workers use the Linux
FIFOpolicy to let functions run to completion—or until they hit a dynamically calculated time slice ($S$). This prioritizes short functions, letting them finish instantly without context switches. - The CFS Pool (Bottom Level): If a function exceeds the time slice $S$, it is "filtered" out and demoted to the standard Linux
CFSscheduler. This ensures that long-running tasks don't starve the system while still allowing them to eventually complete.
Key Innovations: * Dynamic Time Slicing: SFS uses queuing theory (the $M/G/c$ model) and historical inter-arrival times to adapt the time slice $S$ in real-time. * I/O Awareness: SFS polls kernel process status to detect when a function is blocked by I/O, ensuring it doesn't waste its "FILTER" time slice credit while waiting. * Hybrid Overload Handling: If the system detects a transient burst of requests (overload), it temporarily bypasses the FILTER pool to prevent massive queuing delays, falling back to CFS until the backlog clears.
Datasets
The researchers evaluated SFS using:
- Azure Functions Workload Traces: A publicly available dataset representing real-world production FaaS patterns.
- FaaSBench: A newly introduced, highly configurable workload generator that models function behaviors (CPU-heavy vs. I/O-heavy) and arrival patterns based on the Azure traces.
Key Insights and Ideas
- Fairness is Unfair: The "aha moment" is that CFS’s task-level fairness creates application-level unfairness. Short, latency-sensitive functions suffer disproportionately from waiting times compared to long-running batch jobs.
- RTE as a North Star: The authors define Run-Time Effectiveness (RTE)—the ratio of actual CPU service time to total turnaround time. An RTE of 1.0 is the ideal. As shown in the paper's motivational study, CFS often results in very low RTE for short functions.
- SRTF is the Oracle: While Shortest Remaining Time First (SRTF) is theoretically optimal for minimizing turnaround time, it requires knowing the future. SFS effectively approximates this "offline oracle" using its two-level filtering mechanism.
Key Results
- Massive Speedups: For 83% of functions (the short-lived majority), SFS improved execution duration by an average of 49.6x compared to CFS.
- Minimal Penalty: The remaining 17% of longer functions only saw a modest 1.29x increase in duration, a trade-off the authors argue is well worth the gain for the majority.
- Context Switch Reduction: SFS drastically reduced overhead; for 85% of requests, CFS suffered 10x more context switches than SFS.
- Low Overhead: The user-space implementation is efficient, requiring only about 3.6% relative CPU overhead to manage a 72-core deployment.
Limitations and Future Work
- Cold Starts: While SFS optimizes the "last mile" of execution, it does not address the "cold start" problem (the time taken to initialize a function's container). The authors note that as cold start optimizations improve, OS scheduling becomes the next major bottleneck.
- Global Coordination: SFS currently operates at the local server level. Future work could involve coordinating SFS with global FaaS schedulers to better distribute long-running vs. short-lived functions across a cluster.
- SLO Integration: The authors suggest that SFS could enable new, more precise Service Level Objectives (SLOs) for FaaS based on the RTE metric.
Summary updated