arXiv:2610.36636cs.DCOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.36636

Agar: What-If Analysis for Microservice Applications

Saarth Deshpande, Neeraja J. Yadwadkar, Venkat Arun

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Microservice operators must reason about how applications would behave under changes that have not yet occurred: different workloads, resource allocations, or SLO targets. Evaluating every alternative experimentally is expensive, but predicting such counterfactuals is difficult because microservices contain many interacting components. End-to-end models must learn behavior over a combinatorial space of conditions, but composing per-component predictors causes prediction errors to accumulate.

We address this challenge by changing what each component model must predict. Rather than predicting exact values, we learn simple, interpretable bounds that contain every observed behavior while remaining tight enough to support useful end-to-end conclusions. We build AGAR, a counterfactual performance analysis tool that composes these models to answer end-to-end SLO-feasibility questions. This allows us to formulate autoscaling as a counterfactual query: what is the smallest resource allocation under which an SLO is met? Our evaluation demonstrates that across three microservice applications, AGAR's bounds are actionable: its derived autoscaler reduces CPU allocation by up to 36.8% over state-of-the-art horizontal autoscalers while satisfying application SLOs. Further, AGAR is able to predict operational cost given workload traces, provide guidance on which service's startup time to optimize and localize performance bugs within each application.

1 Introduction

Microservice operators constantly make decisions that can alter application performance: how many resources to allocate, how services are configured, what hardware to run them on [65], and which service's performance to optimize [60]. A wrong choice can waste resources [24, 57], violate Service Level Objectives (SLOs) [10, 47, 50], or fail to address the actual bottleneck [18, 58]. However, the effect of a choice is often hard to know without deploying it. This is especially expensive in microservices, where local changes rarely stay local: changing one component can shift bottlenecks across the application. Performance can also change with the underlying environment, with different hardware surfacing failures that did not appear elsewhere. Because the impact of a choice must ultimately be established by observing application behavior over time [29, 54], evaluating each choice requires deploying and exercising the application under representative conditions, making exploration across many configurations expensive [52].

Operators need to know whether a proposed change will actually solve an observed performance problem, and what it will cost, without having to deploy the change. This requires reasoning about how the application would behave under alternatives that have not been tried out yet. Would adding more resources restore SLO compliance or is the bottleneck elsewhere? Is the SLO unattainable under the current workload regardless of resource allocation? How much cost could be saved if we relaxed the SLO by a certain amount? Would optimizing one component reduce the overall resource needs of the application? These are counterfactual questions: they ask what would have happened under a change that was not actually made.

A growing body of systems work has explored counterfactual prediction for networks [2, 11], storage [45, 61], and application behavior [18, 50, 60]. These systems show that learned models can predict behavior under decisions that were not actually exercised, but applying this idea to microservices exposes a fundamental scaling challenge. An end-to-end model must directly learn application behavior as a function of the workload, resource allocation, and an SLO target to effectively capture the joint behavior of many interacting microservices over a combinatorial space of conditions, many of which may never have been exercised.

A natural alternative is to decompose the application into per-component models. This narrows the behavior that each model must capture, but creates a different challenge: prediction errors compound as models are composed. With 50

∗^{*}Equal advisory contribution.

component models, for example, naively guaranteeing 95% confidence that the composition is correct would require each model to be correct roughly 99.9% of the time.

The key is to change what we require from each component model. Rather than requiring a model to predict a single value, such as CPU utilization, perfectly, we make its uncertainty explicit. For example, the model may predict that utilization lies between, say, 25–35%. This allows models to achieve 100% accuracy. Unfortunately, they may do so vacuously by always predicting a range of 0 to ∞\infty. In practice, however, our models achieve 100% accuracy while remaining precise enough to be useful. This not only addresses the model-composability problem, but also makes model errors and data drift easy to detect: the first observation that falls outside a predicted range signals that the model must be retrained.

Making uncertainty explicit also allows us to use simple models motivated by system intuition. For example, we might model average CPU utilization as inversely proportional to the number of CPUs allocated. Such a model does not explicitly capture effects such as cross-VM interference or sudden bursts of garbage collection; instead, their observed effects are absorbed into the model's uncertainty bounds. More expressive models, including large neural models or LLM-based predictors, could attempt to capture these effects directly, but doing so introduces additional data requirements and complexity that are unnecessary for our goal. We do not need to predict behavior exactly; we need bounds that are tight enough to support useful counterfactual conclusions. Simple models can provide such bounds with less data, while remaining easier to interpret and compose across services.

We jointly fit the component models to minimize uncertainty in the end-to-end quantity predicted by their composition—for example, the average resource cost of meeting a given SLO—while requiring each model to fit all observed data. We prove that this optimization problem is NP-hard (Appendix B). We develop an efficient greedy algorithm with a log⁡(n)+1\log(n) + 1 approximation guarantee for n data points, and show that it performs well in practice.

Guided by these insights, we introduce AGAR, a counterfactual performance analysis tool to answer end-to-end SLO-feasibility questions. AGAR learns per-component models that fit every observation, then composes them to reason about hypothetical changes in workload, resource allocation, and SLO targets. Using these models to identify the smallest resource allocation that can satisfy a target SLO directly yields an autoscaler. Across three microservice applications, we demonstrate that the bounds found by AGAR are actionable. Using these bounds, AGAR's autoscaler reduces CPU allocation by up to 36.8% over state-of-the-art horizontal autoscalers while satisfying application SLOs. When the bounds fail to hold, they expose previously unknown performance problems in all three applications (see §5.3).

Figure

(a) Backpressure keeps frontend CPU above the HPA threshold.

Figure

(b) HPA scales frontend while AGAR scales the bottlenecked slow-service.

Figure

(c) AGAR keeps p95 latency below 500 ms by scaling slow-service.

Figure 1: Backpressure case study. (a) Under constant load, frontend workers busy-spin on the CPU while awaiting responses from slow-service, causing CPU utilization to remain above its HPA threshold longer. (b) HPA consequently scales frontend to ∼\sim18 replicas while adding only one slow-service replica, leaving the backend bottleneck unresolved. (c) p95 latency climbs to ∼\sim6 s. AGAR instead identifies slow-service as the bottleneck and scales it out, keeping p95 below 500 ms after its models converge.

References (46)