EcoLife: Carbon-Aware Serverless Function Scheduling for Sustainable Computing

Yankai Jiang, Rohan Basu Roy, Baolin Li, Devesh TiwariarXiv 2024

TL;DR

ECOLIFE is the first carbon-aware serverless function scheduler designed to jointly optimize execution performance and environmental sustainability. By strategically balancing function "keep-alive" states across older and newer hardware generations, ECOLIFE achieves near-optimal carbon reductions with minimal impact on function response times.

What Problem Does This Paper Address?

Serverless computing (Function-as-a-Service) abstracts away infrastructure management, but it introduces a unique environmental challenge: the "keep-alive" period. To avoid the high latency of a "cold start" (loading a function into memory from scratch), cloud providers keep function containers warm in memory for a set period after execution. However, keeping these functions idle continuously draws energy and ties up hardware resources.

The total carbon footprint of a serverless function consists of two parts: embodied carbon (emissions from manufacturing the hardware) and operational carbon (emissions from the electricity grid during use). Older hardware has lower remaining amortized embodied carbon but is less energy-efficient; newer hardware is highly efficient but carries a massive manufacturing carbon debt. Furthermore, grid carbon intensity fluctuates dynamically over time. Existing schedulers either ignore carbon entirely or focus solely on energy efficiency, missing the complex trade-offs between hardware generations, keep-alive times, and dynamic grid conditions.

Methods

The authors introduce ECOLIFE, a scheduling framework that models the joint optimization of service time and carbon footprints across multi-generational hardware.

  • Objective Function: ECOLIFE mathematically balances normalized service time, execution carbon, and keep-alive carbon to evaluate scheduling choices. ECOLIFE Objective Function
  • Dynamic Particle Swarm Optimization (DPSO): ECOLIFE extends vanilla PSO to handle the highly volatile serverless environment. It features a perception-response mechanism that monitors real-time changes in function invocation frequency ($\Delta F$) and grid carbon intensity ($\Delta CI$). When a shift is detected, it dynamically adjusts exploration weights and randomizes half of the particle swarm to escape local optima.
  • Warm Pool Adjustment: Because memory is finite, ECOLIFE implements a priority eviction mechanism. It ranks functions based on the carbon and performance penalties of a cold start vs. a warm start, gracefully evicting lower-priority functions from newer hardware to older hardware's memory pools rather than dropping them entirely.
  • Execution Placement Decision Maker (EPDM): Directs incoming requests to the optimal hardware generation based on whether a warm container already exists and the current grid carbon intensity.
ECOLIFE Objective Function

Datasets

  • Workload Traces: Real-world serverless function invocation traces from Microsoft Azure.
  • Benchmarks: The SeBS (Serverless Benchmark Suite), utilizing diverse workloads like video processing, graph search (Graph-BFS), and DNA visualization.
  • Carbon Intensity: Real-time grid data from Electricity Maps, focusing on the California Independent System Operator (CISO) region, with additional robustness testing using data from Tennessee (TEN), Texas (TEX), Florida (FLA), and New York (NY).

Key Insights and Ideas

  • Keep-Alive Dominates: For many serverless functions, the carbon footprint generated while sitting idle in memory (keep-alive) is significantly higher than during actual execution. This is because keep-alive periods last minutes, while execution takes milliseconds to seconds. Carbon footprint breakdown during keep-alive vs service
  • The Older-Hardware Opportunity: Because older hardware has lower embodied carbon, you can "afford" to keep functions alive on it for much longer within the same carbon budget. This drastically increases the chance of a "warm start," eliminating the high operational carbon spike and latency associated with cold starts on newer hardware. Service time vs carbon footprint across generations
  • The "Inverted Case": Keeping functions alive on older hardware isn't a silver bullet. When grid carbon intensity is very low, the high operational efficiency of newer hardware wins out, meaning the optimal choice flips depending on temporal grid fluctuations. Carbon intensity trade-offs and the inverted case
  • Energy $\neq$ Carbon: Traditional energy-optimal schedulers perform poorly at carbon reduction because they completely ignore the manufacturing (embodied) carbon overhead of the underlying chips. Comparison of optimization strategies against the Oracle
Carbon footprint breakdown during keep-alive vs service
Fig. 2. The serverless functions can incur a lower overall carbon footprint if kept alive and executed on older-generation hardware due to lower keep-alive carbon footprint (e.g., AOLD vs. ANEW), but they can suffer from performance degradation. However, the impact on performance can be relatively small for some functions with significant savings in carbon footprint (e.g., Graph-BFS on COLD vs. CNEW). The keep-alive period is the same and constant (10 minutes) for all cases.
Fig. 3. Trade-off between carbon footprint and service time: A longer keep-alive period on older-generation hardware can potentially reduce both service time and carbon footprint, but the magnitude and feasibility depend on function characteris- tics and carbon intensity. Case A: keep alive for 15 mins on COLD, receive a warm start (no cold start overhead) but slower execution. Case B: keep alive for 10 mins on CNEW, and suffer from cold start but faster execution time.
Fig. 4. CO2-OPT, SERVICE-TIME-OPT and ENERGY-OPT are far from the ORACLE. There is an opportunity to jointly optimize the overall carbon footprint and service time, but it is challenging to exploit. (AOLD vs ANEW)

Key Results

  • Near-Oracle Performance: ECOLIFE performs remarkably close to a theoretical, brute-forced optimal "ORACLE" solution, staying within 7.7% for average service time and 5.5% for carbon footprint.
  • Outperforming Baselines: Compared to a standard "new hardware only" policy, ECOLIFE reduces carbon emissions by 8.6%. Compared to an "old hardware only" policy, it slashes function service time by 12.7%.
  • Negligible Overhead: The extended PSO algorithm is highly efficient, consuming less than 0.4% of total service time and accounting for just 1.2% of the carbon footprint for decision-making.

Limitations and Future Work

  • Embodied Carbon Inaccuracies: Calculating embodied carbon relies heavily on external vendor data and lifecycle assessment methodologies, which are inherently prone to minor estimation errors (though the authors show ECOLIFE remains robust even with a $\pm10\%$ variance).
  • CPU-Centric Focus: The current implementation focuses primarily on CPU-based serverless environments. While the underlying multi-generational trade-offs apply to GPUs, adapting ECOLIFE for heterogeneous GPU clusters requires future work on GPU-specific carbon modeling.
  • Data Center Maintainability: Mixing multiple generations of hardware can introduce operational and maintenance complexities for infrastructure teams, an area that requires further long-term study.

Summary updated

Abstract

This work introduces ECOLIFE, the first carbon-aware serverless function scheduler to co-optimize carbon footprint and performance. ECOLIFE builds on the key insight of intelligently exploiting multi-generation hardware to achieve high performance and lower carbon footprint. ECOLIFE designs multiple novel extensions to Particle Swarm Optimization (PSO) in the context of serverless execution environment to achieve high performance while effectively reducing the carbon footprint.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
SeBS serverless workloads following the Microsoft Azure traceEcoLifeaverage service time7.7%Serverless Function Scheduling · trace=Microsoft Azure · hardware=Pair A · evaluation=trace-driven simulation
Source quote
L306: In Fig.~\ref{fig:result}, EcoLife{} stands out as the closest scheme to the Oracle{} in terms of carbon footprint and service time among all the schemes. Recall from Sec.~\ref{sec:motiv}, CO_2-Opt{}, Service-Time-Opt{} and Energy-Opt{} only minimize carbon footprint, service time and energy consumption respectively, and all of them are significantly far away from the Oracle{}. However, implementing the Oracle{} directly in real-world systems is impractical. EcoLife{} co-optimize both metrics, while bridging the gap between sustainability and execution performance. Compared to Oracle{}, EcoLife{} experiences a 7.7% increase in average service time and a 5.5% increase in average carbon footprint, respectively. Furthermore, EcoLife{} is close to Oracle{} from the perspective of individual function invocations. As shown in Fig.~\ref{fig:CDF}, we present the cumulative distribution function (CDF) of service time and carbon footprint respectively, and both service time and carbon footprint remain less than 1% for each percentile of invoked functions. The service time is the average service time which includes queuing delay, setup delay, cold start (if applicable), and execution time. The P95 latency of EcoLife{} is within 15% increase of the service time in Oracle{}. EcoLife{} decision-making overhead is also low and practical, less than 0.4% of service time, and 1.2% of carbon footprint for the invocation loads in the Azure trace. EcoLife{} achieves scalability by addressing the memory limitation problem of the co-located function with the warm pool adjustment.
SeBS serverless workloads following the Microsoft Azure traceEcoLifeaverage carbon footprint5.5%Serverless Function Scheduling · trace=Microsoft Azure · hardware=Pair A · evaluation=trace-driven simulation
Source quote
L306: In Fig.~\ref{fig:result}, EcoLife{} stands out as the closest scheme to the Oracle{} in terms of carbon footprint and service time among all the schemes. Recall from Sec.~\ref{sec:motiv}, CO_2-Opt{}, Service-Time-Opt{} and Energy-Opt{} only minimize carbon footprint, service time and energy consumption respectively, and all of them are significantly far away from the Oracle{}. However, implementing the Oracle{} directly in real-world systems is impractical. EcoLife{} co-optimize both metrics, while bridging the gap between sustainability and execution performance. Compared to Oracle{}, EcoLife{} experiences a 7.7% increase in average service time and a 5.5% increase in average carbon footprint, respectively. Furthermore, EcoLife{} is close to Oracle{} from the perspective of individual function invocations. As shown in Fig.~\ref{fig:CDF}, we present the cumulative distribution function (CDF) of service time and carbon footprint respectively, and both service time and carbon footprint remain less than 1% for each percentile of invoked functions. The service time is the average service time which includes queuing delay, setup delay, cold start (if applicable), and execution time. The P95 latency of EcoLife{} is within 15% increase of the service time in Oracle{}. EcoLife{} decision-making overhead is also low and practical, less than 0.4% of service time, and 1.2% of carbon footprint for the invocation loads in the Azure trace. EcoLife{} achieves scalability by addressing the memory limitation problem of the co-located function with the warm pool adjustment.
Microsoft Azure trace invocation loadsEcoLifedecision-making overhead as a share of carbon footprint1.2%Serverless Function Scheduling · load=invocation loads · evaluation=decision-making overhead
Source quote
L306: In Fig.~\ref{fig:result}, EcoLife{} stands out as the closest scheme to the Oracle{} in terms of carbon footprint and service time among all the schemes. Recall from Sec.~\ref{sec:motiv}, CO_2-Opt{}, Service-Time-Opt{} and Energy-Opt{} only minimize carbon footprint, service time and energy consumption respectively, and all of them are significantly far away from the Oracle{}. However, implementing the Oracle{} directly in real-world systems is impractical. EcoLife{} co-optimize both metrics, while bridging the gap between sustainability and execution performance. Compared to Oracle{}, EcoLife{} experiences a 7.7% increase in average service time and a 5.5% increase in average carbon footprint, respectively. Furthermore, EcoLife{} is close to Oracle{} from the perspective of individual function invocations. As shown in Fig.~\ref{fig:CDF}, we present the cumulative distribution function (CDF) of service time and carbon footprint respectively, and both service time and carbon footprint remain less than 1% for each percentile of invoked functions. The service time is the average service time which includes queuing delay, setup delay, cold start (if applicable), and execution time. The P95 latency of EcoLife{} is within 15% increase of the service time in Oracle{}. EcoLife{} decision-making overhead is also low and practical, less than 0.4% of service time, and 1.2% of carbon footprint for the invocation loads in the Azure trace. EcoLife{} achieves scalability by addressing the memory limitation problem of the co-located function with the warm pool adjustment.
BibTeX
@misc{jiang2024ecolife,
  author = {Yankai Jiang and Rohan Basu Roy and Baolin Li and Devesh Tiwari},
  title = {{EcoLife: Carbon-Aware Serverless Function Scheduling for Sustainable Computing}},
  year = {2024},
  eprint = {2409.02085},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.02085},
}

Loading related content...

Figure