Autoscaling and Capacity Planning

Topics Covered

Capacity for LLM Serving

Capacity is defined by objectives

Units of capacity

Measuring a replica

What limits a replica

Headroom

Capacity for multiple models

A worked capacity estimate

Little law for concurrency

Capacity per dollar, not per GPU

Common mistakes in capacity estimates

Capacity reviews as a habit

Separating capacity by tier

Capacity planning answers a simple question with a complicated answer: how many GPUs do we need to serve this traffic within our latency objectives, and how should that number change over time? This lesson covers how to measure the capacity of a replica, how autoscaling works for GPU workloads and why it is harder than for ordinary services, how to deal with slow start up, how to plan capacity over weeks and months, and how to absorb spikes without overspending.

Capacity is defined by objectives

The capacity of a replica is not a single number. A replica can generate many more tokens per second if users accept slow responses, because larger batches improve throughput while raising TPOT. The meaningful capacity is the highest load at which the replica still meets its objectives, for example a 95th percentile TTFT under one second and TPOT under fifty milliseconds. Different objectives give different capacities for the same hardware, so capacity planning always starts by writing the objectives down.

More load means more throughput, until latency bends upward. Capacity is the load just before latency crosses the objective.

Units of capacity

Capacity can be expressed in requests per second, concurrent sequences, input tokens per second or output tokens per second. None is perfect alone, because the mix of prompt and output lengths changes what a replica can handle. A replica might handle twenty requests per second of short chat but only two per second of long document summaries. Practical capacity models therefore describe load with at least two dimensions, such as prefill tokens per second and decode tokens per second, or concurrent sequences and average context length, and measure the replica limit for the traffic mix actually seen.

Measuring a replica

The standard method is a load test against one replica with a realistic traffic mix, sweeping load from light to saturation and recording TTFT and TPOT percentiles, throughput and cache utilization at each level. The highest load meeting objectives is the replica capacity for that mix. Repeating the test for a few mixes, short prompts, long prompts and the production blend, shows how sensitive capacity is to the mix. These numbers become the foundation for autoscaling thresholds and long term plans, and they should be remeasured whenever the engine, model, hardware or configuration changes.

What limits a replica

Depending on the workload, different resources run out first. For long prompts, prefill compute is often the limit, showing up as rising TTFT. For many concurrent long conversations, KV cache memory runs out, showing up as preemptions and waiting queues. For short prompts with long outputs, decode throughput limits, showing up as rising TPOT once batches grow large. For very small models at high request rates, CPU overhead in the engine can be the limit. Knowing which resource binds tells you which optimization or hardware change would add capacity.

Headroom

Running replicas at exactly their measured capacity leaves no margin for traffic fluctuations, a replica failure or a shift toward longer prompts. Plans usually target a utilization below capacity, for example seventy to eighty percent of the measured limit, leaving headroom. The right amount depends on how bursty traffic is, how fast new capacity can be added and how costly it is to miss objectives. Faster autoscaling allows less headroom; slow scaling and strict objectives require more.

Capacity for multiple models

Many platforms serve several models, each with its own replicas and traffic pattern. Capacity is planned per model, but GPUs are shared at the cluster level, so the sum of all models peak needs, adjusted for whether peaks coincide, determines the total GPU count. Models with complementary traffic, such as one busy in business hours and another busy overnight with batch work, can share a GPU pool if replicas can move between models, which raises overall utilization. This is one motivation for multi model serving techniques covered in later lessons.

A worked capacity estimate

Suppose a chat model runs on one replica of two GPUs. A load test with the production mix, average prompt of fifteen hundred tokens with heavy prefix sharing and average output of three hundred tokens, shows that the replica meets a p95 TTFT of one second and TPOT of forty milliseconds up to about sixty concurrent sequences, or roughly three requests per second. Beyond that, the cache fills and TTFT climbs quickly. Peak traffic is forecast at thirty requests per second. Dividing gives ten replicas at full capacity; targeting seventy five percent utilization raises it to about fourteen, and adding one spare for failures gives fifteen replicas, or thirty GPUs, at peak. The same arithmetic run at the overnight trough of five requests per second gives three replicas, which is where the autoscaling range comes from.

The estimate is only as good as its inputs. If the product adds a feature that doubles average prompt length, capacity per replica might fall by a third, and the plan changes with it. This is why capacity models should be parameterized by the traffic mix and rerun whenever product changes shift it.

Little law for concurrency

A useful identity links request rate, latency and concurrency: the average number of requests in flight equals the arrival rate times the average time each request spends in the system. At three requests per second with an average end to end time of fifteen seconds for a streamed response, about forty five requests are in flight on average. Since KV cache memory scales with concurrent sequences, this simple multiplication tells you how much cache a given traffic level needs. It also shows why long outputs are expensive: doubling the average generation time doubles the concurrency, and therefore the memory, at the same request rate.

Requests arrive at a steady rate and each stays a while. The count in flight settles at rate times time. Longer stays mean more in flight.

Capacity per dollar, not per GPU

When comparing deployment options, the meaningful figure is capacity per dollar: how many requests per second at the objectives each option delivers per hour of spend. A larger GPU might deliver twice the capacity of a smaller one at three times the price, making it worse value for this workload, or it might allow a larger batch and a better cache hit rate that make it better value. Running the capacity test on each candidate and dividing by price makes the comparison honest, and it often surprises teams that assumed the newest hardware is always the best buy.

Common mistakes in capacity estimates

Several mistakes recur. Using average prompt length rather than the distribution understates the impact of a long tail of large prompts. Testing with no prefix sharing overstates prefill cost for chat products, while testing with perfect sharing understates it. Measuring throughput at saturation rather than at objectives overstates capacity. Ignoring retries, cancellations and health check traffic understates load. Forgetting that one replica must be spare during upgrades understates the replica count. Each mistake is easy to avoid once named, and a short review checklist catches most of them.

Capacity reviews as a habit

Capacity numbers age quickly. A monthly review that compares measured replica capacity, current traffic mix and utilization against the plan keeps everyone working from current figures. The review should note which resource bound each model during its peak, how close each model came to its objectives, and what changed since the last review, such as engine upgrades, new features or new customers. Over time, this record becomes the best predictor of how future changes will affect capacity, far better than rules of thumb.

Separating capacity by tier

When a platform offers several service tiers, such as a low latency tier and a cheaper standard tier, each tier has different objectives and therefore different capacity per replica. Measuring capacity per tier, and deciding whether tiers share replicas or run in separate pools, makes the plan reflect what was promised to each group of users.

Capacity is a property of hardware, model, engine, traffic mix and objectives together

Change any one of them and the capacity changes. Remeasure after every significant change instead of reusing an old number.