HarmonyBatch: Batching multi-SLO DNN Inference with Heterogeneous Serverless Functions

Jiabin Chen, Fei Xu, Yikun Gu, Li Chen, Fangming Liu, Zhi Zhou

Abstract

Serverless computing offers a scalable and flexible platform for Deep Learning (DNN) inference, yet it faces significant cost and performance challenges due to low request rates and the complexity of choosing between heterogeneous hardware options. We present HarmonyBatch, a resource provisioning framework designed to optimize multi-application DNN inference. By leveraging analytical performance models and a two-stage merging strategy, HarmonyBatch intelligently groups requests with varying Service Level Objectives (SLOs) to maximize batching efficiency. Experimental results using real-world traces demonstrate that HarmonyBatch reduces costs by up to 82.9% compared to state-of-the-art methods while maintaining a 0% SLO violation rate.

Introduction

Serverless platforms, such as AWS Lambda and Alibaba Function Compute, have become increasingly popular for DNN inference due to their ability to scale instantly. However, two primary hurdles prevent these platforms from being cost-efficient for AI workloads. First, many serverless applications suffer from the "Ghost Town" traffic problem, where request rates are too low to form efficient batches without exceeding latency deadlines. Second, the introduction of heterogeneous hardware—specifically the choice between CPU and GPU serverless functions—creates a complex optimization challenge. CPUs are often more economical for small, sporadic tasks, while GPUs offer superior throughput for large batches. Deciding how to group diverse applications and which hardware to provision is an NP-hard problem that existing tools fail to solve holistically.

Methodology

HarmonyBatch addresses these challenges through a multi-faceted approach to resource provisioning and request management:

1. Analytical Performance and Cost Modeling

The framework utilizes a mathematical model to predict inference latency and monetary costs on both CPUs and GPUs. A critical component of this model is its accounting for GPU "time-slicing." In many cloud environments, multiple functions share a single physical GPU via temporal slicing. HarmonyBatch models these rotations to prevent the latency spikes that occur when a request arrives just as its allocated GPU slice ends.

2. Two-Stage Merging Strategy

To optimize application grouping, HarmonyBatch employs a two-stage heuristic:

  • Stage 1 (CPU to GPU): The system identifies "knee points" in traffic—specific arrival rate thresholds where the cost-effectiveness of moving multiple CPU-based applications to a shared GPU function becomes clear.
  • Stage 2 (GPU Consolidation): The framework further analyzes applications already assigned to GPUs, merging them to create larger batches and further reducing the cost per request.

3. SLO-Aware Batching

HarmonyBatch leverages the "slack" in an application's SLO. By pairing applications with tight deadlines with those possessing looser requirements, the system can buffer requests long enough to fill a GPU batch without violating any individual Service Level Objectives.

4. Efficient Provisioning

To minimize computational overhead, the researchers derived mathematical theorems that allow the system to use binary search to find the optimal number of vCPU cores or GPU memory for a specific batch size. This avoids the need for exhaustive searches across all possible resource combinations.

Evaluation

The researchers evaluated HarmonyBatch using four representative DNN models: VideoMAE (video analytics), VGG-19 (image processing), BERT (NLP), and GPT-2 (LLM). Tests were conducted by replaying real-world traffic patterns from the Microsoft Azure Functions and Huawei Public Cloud traces.

Key Results

  • Cost Efficiency: HarmonyBatch reduced monetary costs by up to 82.9% compared to the BATCH baseline and by 16.1% to 59.6% compared to recent heterogeneous strategies like MBS+.
  • Model Accuracy: The latency prediction model proved highly reliable, with error rates for average and maximum latency ranging between 0.1% and 11.4%.
  • Reliability: While competing methods often resulted in SLO violations, HarmonyBatch maintained a 0% violation rate across all tested scenarios.
  • System Overhead: The optimization algorithm is highly performant, finding an optimal execution plan for 12 different applications in just 38 milliseconds.

Conclusion and Future Work

HarmonyBatch demonstrates that intelligent, heterogeneous batching can significantly lower the barrier to cost-effective AI on serverless platforms. While the current prototype is optimized for single-model functions on Alibaba Cloud, future iterations aim to support model partitioning for massive LLMs (like GPT-4) and expand compatibility to other major cloud providers. Additionally, the researchers plan to investigate the interplay between batching strategies and serverless "cold starts" to further refine performance.

Summary updated

BibTeX
@inproceedings{chen2024harmonybatch,
  author = {Jiabin Chen and Fei Xu and Yikun Gu and Li Chen and Fangming Liu and Zhi Zhou},
  title = {{HarmonyBatch: Batching multi-SLO DNN Inference with Heterogeneous Serverless Functions}},
  booktitle = {IWQoS},
  year = {2024},
  doi = {10.1109/iwqos61813.2024.10682915},
}
Figure