Abstract
Serverless computing, or Function-as-a-Service (FaaS), offers developers high scalability and modularity. However, its complex pricing model—which charges for memory allocation, execution duration, and function-to-function transitions—often leads to inefficient resource utilization and high costs. This paper introduces Costless, an optimization framework designed to minimize serverless workflow costs. By jointly optimizing function fusion (merging functions) and placement (deciding between cloud and edge execution), Costless achieves cost reductions of up to 57% while adhering to strict user-defined latency targets.
Introduction
In modern cloud architectures, applications are often decomposed into small, independent functions. While this modularity simplifies development, it introduces significant economic and performance challenges:
- Transition Costs: Cloud providers typically charge for every state transition between functions. In complex workflows, these "micro-taxes" can become a dominant portion of the total bill.
- The Fusion Dilemma: Fusing functions can eliminate transition fees, but it introduces resource inefficiencies. For example, if a high-memory function is fused with a low-memory function, the user must pay for the higher memory tier for the entire duration of the fused execution.
- Placement Logic: The rise of Edge computing allows developers to offload tasks to local devices (e.g., IoT gateways) for a flat fee. Determining which functions should remain on the fast-but-expensive cloud versus the slower-but-cheaper edge is a complex combinatorial problem.
The Costless Framework
Costless treats the optimization of serverless workflows as a mathematical challenge, specifically a Constrained Shortest Path (CSP) problem. The goal is to find the cheapest execution path that does not exceed a specified time limit.
Joint Optimization Strategy
Unlike previous solutions that address memory or placement in isolation, Costless performs a joint optimization across three dimensions:
- Function Fusion: Merging sequential functions to eliminate transition costs.
- Function Placement: Deciding whether a function or fused block should run on the Cloud or at the Edge.
- Memory Allocation: Selecting the optimal memory size for cloud functions, noting that higher memory often provides faster CPU speeds, which can paradoxically lower total costs by reducing execution time.
The Cost Graph and LARAC Algorithm
The framework constructs a directed graph where every possible fusion and placement combination is represented as a node. Each edge in this graph is weighted with two values: monetary price and execution delay. To solve this NP-Hard problem efficiently, Costless employs the LARAC algorithm, which uses Lagrange multipliers to find near-optimal solutions in sub-second timeframes.
Evaluation and Results
The researchers evaluated Costless using the Wild Rydes Image Processing Workflow, a standard AWS sample application, alongside synthetic workflows of up to 100 functions. The hardware setup included a Raspberry Pi Model B as the Edge device and AWS Lambda/Step Functions for the Cloud infrastructure.
Key Findings
- Significant Cost Savings: Costless identified configurations that reduced application costs by 35% to 57% compared to baseline deployments.
- Performance Trade-offs: These savings were achieved with a minimal impact on performance, typically increasing latency by only 5% to 15%, well within user-defined constraints.
- High Scalability: While brute-force methods fail beyond 12 functions, Costless successfully optimized 100-function workflows in less than one second.
- Model Precision: The framework's predictive models were highly accurate, coming within 1.2% of actual AWS billing and 4% of measured execution time.
Conclusion
Costless demonstrates that the "transition tax" and resource mismatches in serverless computing can be mitigated through intelligent, automated optimization. By treating fusion and placement as a unified problem, the framework allows developers to leverage the best of both cloud and edge environments. Future work aims to automate the code-merging process and introduce dynamic re-optimization to handle functions with highly variable input data.
Summary updated