TL;DR
This paper investigates the viability of serverless computing for machine learning model serving, a critical but often overlooked part of the ML lifecycle. Through extensive benchmarking on AWS and GCP, the authors find that serverless platforms can outperform traditional cloud-based solutions, including managed ML services and even GPU servers in certain scenarios, offering a compelling balance of performance, cost, and ease of management.
What Problem Does This Paper Address?
The modern data science pipeline extends beyond traditional analytics to encompass the full machine learning lifecycle, including model training and, crucially, model serving. Model serving makes ML models available to end-users, demanding high performance, low cost, and ease of management. While cloud providers offer managed ML services and self-rented servers, these often fall short on all three fronts. Serverless computing, with its inherent elasticity and fine-grained cost model, presents a promising alternative. However, its suitability for the unique demands of model serving, particularly its often unpredictable and bursty workloads and the need for low-latency inference, has not been thoroughly explored. This paper aims to bridge this gap by evaluating serverless model serving against established alternatives.
Methods
The authors conducted a comprehensive evaluation of serverless model serving against other cloud-based options. Their methodology involved:
- System Comparison: Evaluating eight systems across two major cloud providers (AWS and GCP), including serverless platforms (AWS Lambda, Google Cloud Functions), managed ML services (AWS SageMaker, Google AI Platform), and self-rented CPU/GPU servers.
- Model Diversity: Using three deep learning models of varying sizes and complexities: MobileNet and VGG (image classification) and ALBERT (natural language processing).
- Workload Simulation: Generating synthetic workloads using the Markov-Modulated Poisson Process (MMPP) model to simulate low, medium, and high request rates, reflecting unpredictable and bursty traffic patterns.
- Evaluation Metrics: Measuring response latency, request success ratio (SR), and cost.
- Design Space Exploration: Investigating the impact of various serverless configuration parameters, including serving runtimes (TensorFlow vs. OnnxRuntime), memory size, provisioned concurrency, and batch size.
Datasets
The paper does not use pre-existing datasets for training ML models. Instead, it focuses on evaluating the serving performance of pre-trained models. The models used for evaluation were:
- MobileNet: An image classification model (16MB).
- VGG: An image classification model (51.5MB).
- ALBERT: A natural language processing model (548MB).
The paper also generated synthetic workloads using the Markov-Modulated Poisson Process (MMPP) model, with three distinct levels of request rates (workload-40, workload-120, workload-200).
Key Insights and Ideas
- Serverless Shines: Contrary to some prior assumptions, serverless platforms often outperform managed ML services in both cost and performance for model serving.
- GPU vs. Serverless Nuance: While GPUs excel at raw inference speed, serverless can be a surprisingly strong contender, even outperforming GPUs under high, bursty workloads due to its superior elasticity and ability to scale rapidly, often at a comparable cost.
- Runtime Matters: Using a lightweight and optimized serving runtime like OnnxRuntime can significantly reduce latency and cost compared to heavier frameworks like TensorFlow, especially for serverless deployments.
- Cold Starts are Real, But Manageable: Serverless platforms incur cold-start latency, but for many scenarios, this is offset by faster warm-up times and overall elasticity, especially when compared to the slow autoscaling of managed services.
- Serverless is Less Sensitive: Serverless platforms exhibit greater stability and consistency across different workloads and model sizes, making them more predictable than some traditional solutions.
Key Results
- Managed ML vs. Serverless: AWS-Serverless consistently showed significantly lower latency (up to two orders of magnitude) and higher success ratios than AWS-ManagedML. For example, with MobileNet and workload-40, AWS-Serverless was 71.6x faster and 8.56x cheaper.
- CPU Server vs. Serverless: Serverless generally outperformed CPU servers, especially under higher workloads. For MobileNet with workload-40 on AWS, serverless was 104.5x faster and 1.78x cheaper than a CPU server.
- GPU Server vs. Serverless: Under low workloads, GPUs were typically better. However, for MobileNet with workload-200 on AWS, serverless achieved an average latency of 0.097s and a cost of $0.186, compared to a GPU server's 7.52s latency and $0.187 cost – a 77.5x latency improvement at a comparable cost.
- Runtime Impact: Using OnnxRuntime instead of TensorFlow reduced latency by up to 3.61x and cost by up to 4.55x on serverless platforms.
- Platform Differences: AWS-Serverless generally outperformed GCP-Serverless in terms of latency and cost, partly due to faster cold-start times and more efficient instance scaling.
Limitations and Future Work
Limitations:
- Cold Start Impact: While serverless can be competitive, cold-start latency remains a factor, particularly for latency-sensitive applications.
- Autoscaling Black Box: The autoscaling policies of serverless platforms are often opaque, making it difficult for users to fully optimize their deployments.
- Provisioned Concurrency Issues: The current provisioned concurrency model on AWS-Serverless did not consistently improve performance and sometimes even increased cold-started instances, suggesting it's not yet a perfect hybrid solution.
- Batching Trade-offs: While batching can reduce costs, it significantly increases latency, requiring careful consideration of application requirements.
Future Work:
- New Scaling Policies: Developing more intelligent and precise scaling policies for serverless model serving to address over-provisioning and improve latency/cost.
- Data Security: Enhancing serverless platforms with robust data security features, potentially leveraging trusted hardware, to meet strict privacy regulations.
- Design Space Navigation Tools: Creating tools to help data scientists navigate the complex design space of serverless model serving and automatically find optimal configurations.
- Transparent Autoscaling: Encouraging cloud providers to offer more transparency into their autoscaling mechanisms to enable better user control and optimization.
Summary updated