Cost-Efficient Resource Allocation Technique using Bayesian Optimization in Serverless Environment
Korea Computer Congress (KCC 2024)
Summary
Memory-only tuning can miss cheaper options when memory and vCPU are configurable independently. The study searches both resources over combinations supported by the serverless platform.
- Role
- Second authorserverless resource-allocation research
- Outcome
- Found the optimum at iterations 17 and 13 in a 36-configuration GCF search; CPU-bound cost was about 9.43% below the minimum-resource configuration.
Serverless Resource Configurations Beyond Memory-Only Tuning
Serverless functions reduce infrastructure management, but their memory and vCPU settings still determine performance and cost. Excess resources raise cost, while insufficient resources can prolong execution. Prior work COSE uses Bayesian optimization to predict execution time and cost and select a memory setting.
This study targeted environments where memory and vCPU could be configured independently. In the platforms described by the paper, AWS Lambda linked vCPU to memory, while Google Cloud Functions and Knative allowed separate settings. Memory-only tuning could miss cheaper combinations in these environments, motivating a broader search.
Bayesian Optimization That Explores CPU and Memory Together
The search extends COSE’s memory-only input to memory–vCPU pairs. Moving along both axes in very small increments creates many candidates with potentially little performance difference. A discrete space of configurations supported by the platform keeps the search focused on meaningful resource settings.
Independent memory and vCPU settings do not make every combination executable. The search space includes only configurations satisfying GCF’s constraints at the time of the experiment. Config Mapper normalizes inputs with different units and selects the nearest valid combination, avoiding settings the platform cannot accept.
A surrogate model uses measured configurations and costs to estimate the outcomes of untested combinations probabilistically. It provides a basis for evaluating the potential benefit of measuring other configurations instead of repeatedly choosing the cheapest one already observed.
The acquisition function, Expected Improvement (EI), uses these estimates to select the next candidate by its expected improvement over the best cost found so far. It considers both predicted low cost and the potential of less certain configurations, rather than testing all candidates in a fixed order.
Choosing the next configuration from function execution results
The search repeats candidate selection, outcome evaluation, and model updates. In this paper’s evaluation, runtime and cost were first benchmarked for each resource configuration, and those results served as the objective function for Bayesian optimization. Search iterations count successive candidate selections and model updates, separately from the number of function calls used to benchmark each configuration.
Additional resources increase the rate but can shorten execution. Minimum memory and minimum vCPU therefore do not necessarily yield minimum cost. Execution time is measured at each setting to compare the actual objective values.
When EI falls below 5% of its maximum, the search stops and selects the lowest-cost evaluated configuration. This experiment minimizes cost alone. The paper proposes using cost multiplied by runtime as the objective when both should be considered.
9.43% Lower CPU-Bound Cost than the Minimum-Resource Setting
CPU- and memory-intensive functions were each benchmarked ten times across 36 configurations supported by Google Cloud Functions at the time. Using the mean measurements, the search found the best configuration at iteration 17 for the CPU-intensive function and iteration 13 for the memory-intensive function. The paper reports about 9.43% lower cost for the CPU-intensive function than the minimum-resource configuration.
The lowest-cost configuration for the CPU-intensive function was 512MiB and 0.167 vCPU, with a mean runtime of 5.459 seconds. The memory-intensive function took 1.173 seconds at 128MiB and 0.167 vCPU. The paper explains that this light benchmark could run at the minimum memory setting, so more memory did not provide a pronounced benefit.
The objective minimized cost without a latency constraint. More CPU could shorten execution enough to offset its higher unit price. SLO-constrained optimization and evaluation on other platforms remained follow-up work.