Abstract
Elastic scaling is a central benefit of serverless platforms, requiring resources to scale up and down in response to workloads. However, current platforms incorrectly assume that application processing is complete the moment a response is generated. This paper identifies that such platforms do not account for pending asynchronous I/O operations, leading to data inconsistency and "broken promises." We propose an extension to serverless semantics that decouples response generation from termination, demonstrating its efficacy through an implementation in OpenWhisk.
Introduction
Serverless computing, or Functions-as-a-Service (FaaS), promised a world where developers focus solely on code while the platform handles scaling and resource management. However, a fundamental mismatch exists between how these platforms manage resource termination and how modern asynchronous programming languages (like Node.js or Python) actually work. As revealed by Alpernas, Panda, and Sagiv, the aggressive scale-down strategies of platforms like AWS Lambda or OpenWhisk can lead to silent failures in asynchronous tasks.
The Problem: Early Termination and Asynchronous I/O
The core issue is that current serverless platforms couple function termination with the act of sending a response to the user. In a traditional server environment, a background task (like a database write) can continue after a response is sent. In serverless, the platform often "freezes" or terminates the execution environment immediately after the response.
This leads to two critical safety issues:
- Broken Promises: Asynchronous tasks intended to run in the background are killed before completion.
- Cross-Event Interference: If a container is reused, a "zombie" task from a previous request might resume during a subsequent request, potentially corrupting data with stale information.
Methodology: Mapping the Execution Flow
To address this, the authors developed a mathematical model using small-step operational semantics to define function behavior. A key tool in their analysis is the Promise Graph, which maps the causal relationships between asynchronous operations.
As shown in Figure 1, an application might initiate multiple paths. One path leads to producing a response ($p_{18}$), while another handles a background database write ($p_{13}$). If the platform terminates the function upon reaching $p_{18}$, the write operation at $p_{13}$ may never complete or may be interrupted, leading to the "broken promise" scenario.
The researchers modified the OpenWhisk platform to test their proposed solution. They introduced a new await HTTP API and a global end() function, allowing developers to explicitly signal when all background work is truly finished, independent of when the response was sent.
Key Results and Evaluation
The authors evaluated their approach using qualitative analysis of real-world developer issues on Stack Overflow and performance benchmarks on a modified OpenWhisk instance.
- Safety Guaranteed: The proposed semantics were proven to eliminate both broken promises and cross-event interference.
- Low Performance Overhead: The cost of this added safety is minimal. Benchmarks showed an overhead of only 8ms for warm starts and 25ms for cold starts.
- Improved Reliability: By decoupling response from termination, developers can reliably use standard libraries and perform "fire-and-forget" tasks (like logging or secondary writes) without fear of data loss.
Conclusion and Future Work
Current serverless platforms prioritize resource efficiency at the expense of correctness for asynchronous applications. By decoupling response generation from termination, platforms can support modern programming patterns safely. While the current proposal requires manual signaling via end(), future work could leverage static analysis to automate this process, further reducing developer burden while maintaining the integrity of serverless executions.
Summary updated