TL;DR
This paper introduces a formal framework for understanding serverless applications by defining operational semantics that precisely model how functions interact with each other and with platform services. This framework enables the construction of a novel "service call graph," which offers a more comprehensive view of program flow than traditional call graphs, leading to improved static analysis and tooling for serverless development.
What Problem Does This Paper Address?
Serverless computing, particularly the Function-as-a-Service (FaaS) model, has gained significant traction due to its elasticity and managed infrastructure. However, this paradigm shift introduces new challenges for developers, especially in areas like debugging, performance analysis, and security verification. Traditional program analysis techniques struggle to keep pace with the event-driven, distributed nature of serverless applications, where control flow is often dictated by interactions with platform services (like databases and object stores) rather than direct function calls. Existing abstractions often overlook the crucial data transfer and event triggers that define serverless behavior, hindering the development of precise and sound static analysis tools. This paper aims to bridge this gap by providing a formal foundation for understanding and analyzing these complex interactions.
Methods
The core contribution of this paper is the development of new operational semantics specifically designed for serverless computation. These semantics go beyond modeling individual function execution to precisely capture:
- Inter-function control transfer: How functions invoke each other, both directly and indirectly through platform services.
- Interaction with platform services: How functions read from and write to services like object stores, databases, notifications, and queues.
- Event triggers: How state changes in platform services can trigger the execution of other serverless functions.
Based on these semantics, the authors define a service call graph. This graph extends the traditional call graph by introducing nodes for platform services and edges that represent data flow and control transfer mediated by these services. They also present a prototype call graph construction algorithm that leverages these semantics to generate these service call graphs.
Datasets
The paper evaluates its approach by generating service call graphs for 12 real-world serverless JavaScript applications collected from GitHub. These applications were selected based on the presence of serverless configuration files and repository popularity. The authors compare the generated call graphs against manually constructed "ground truth" call graphs to evaluate accuracy.
Key Insights and Ideas
- Serverless is more than just functions: The paper highlights that understanding serverless applications requires modeling not just function-to-function calls but also the critical role of platform services as communication channels and event sources.
- The "service call graph" is a game-changer: By explicitly representing services as nodes and their interactions as edges, this new graph representation provides a much richer and more accurate picture of program flow in serverless architectures. This is crucial for static analysis.
- Non-finality of RESPOND is a key serverless quirk: Unlike traditional functions, a serverless function's response (via
callback) doesn't necessarily signify the end of its execution. The paper demonstrates how functions can continue to interact with services after responding, a behavior that needs to be formally captured. - Failures and retries can lead to unexpected state changes: The paper shows how serverless function failures and retries, especially with non-idempotent operations, can lead to duplicated state updates, a subtle but important issue for application correctness.
- Formal semantics enable practical tools: The formalization of serverless behavior directly leads to the development of practical tools like call graph generators, which can then be used for various analyses.
Key Results
- The authors' call graph construction algorithm achieved high accuracy, producing identical service call graphs to manual inspection for 10 out of 12 evaluated applications.
- For the two applications where edges were missed, the reasons were identified as:
- lane-breach: A web request made directly to another function via an external web API, which is a discouraged pattern and difficult to statically infer.
- citizen-dispatch: Database queries made through third-party library calls, where inferring the exact tables accessed was challenging. The authors suggest over-approximating this behavior in future work.
- The paper demonstrates how the developed semantics and call graphs can be applied to container prewarming, showing a potential performance improvement of nearly 25% by reducing cold start penalties.
Limitations and Future Work
- Third-party library interactions: The analysis currently assumes that third-party libraries do not interact with services. This assumption led to missed edges in some cases, and future work could involve more sophisticated analysis of these libraries.
- Whole-program analysis: While the current approach is static, achieving true whole-program analysis for JavaScript (which is challenging) could further improve accuracy.
- Sufficiency conditions for synchronous semantics: The paper conjectures that synchronous semantics are sufficient for static reasoning but plans to formalize sufficiency conditions in future work.
- Broader application of semantics: The authors intend to use these semantics to construct more advanced analyses and tools for improving performance and security of serverless applications.
Summary updated