LLM Inference Capacity Planning and Graceful Degradation
Large language model inference overloads behave differently from traditional web traffic: per-request cost is unpredictable, concurrency is tightly coupled with GPU memory, and scaling carries physical lag. This article shows how to replace guesswork with computable capacity formulas, drive elastic scaling with queue metrics instead of CPU utilization, and design an explicit degradation ladder that turns "unavailable" into an acceptable suboptimal experience. It also covers productizing honest status communication and shifting strategy from buying traffic to buying certainty, and closes with a practical implementation checklist.
1. Why Overload Is Harder to Handle for LLM Services
Traditional web service overload usually shows up as QPS exceeding capacity. LLM inference overload differs in three fundamental ways, and understanding these three points is the prerequisite for all capacity work.
1. Per-request cost is unpredictable. The same endpoint can serve a one-word “hello” or summarize a 30,000-character document, and the compute cost can differ by two orders of magnitude. Capacity planning by request count (QPS) systematically underestimates the peak.
2. Concurrency is tightly coupled with GPU memory. The key-value cache (KV Cache) grows linearly with context length during inference and stays resident in GPU memory. When memory is exhausted, the system does not just “slow down”—it can no longer admit new sequences, which manifests as rejections, queuing, or timeouts.
3. Scaling has physical lag. Stateless web services scale by pulling images, done in seconds; inference instances must load tens of GB of weights, warm up GPU memory, and complete graph compilation and operator tuning, with cold starts typically on the order of minutes. By the time metrics alert and you scale out, users have already left.
Therefore, the goal of inference capacity engineering is not “never queue” but providing a deterministic, explainable quality of service even when compute is constrained.
2. Capacity Planning: Replacing “Feels Insufficient” with a Computable Formula
2.1 Compute-Side Estimation
Ignoring scheduling overhead, a rough but usable throughput-side estimate is:
Required instances ≈ (Peak QPS × Avg output tokens)/ (Per-instance token throughput × Target utilization)Target utilization is recommended at 0.6–0.7 to leave headroom for bursts and failover
For example, peak 20 QPS, average output 600 tokens, per-instance sustained throughput 2000 tokens/s:
20 × 600 / (2000 × 0.65) ≈ 10 instances
The key action is to turn “average output tokens” from a guess into a measured distribution, and to plan by P95 rather than the mean.
2.2 GPU Memory Constraints (The Real Bottleneck Is Often Here)
The maximum number of concurrent sequences a single instance can hold is determined by remaining GPU memory divided by the per-sequence cache footprint:
Concurrent sequences ≈ (Single-GPU memory − Weight footprint − Runtime and activation overhead)/ Per-sequence KV Cache bytesPer-sequence KV Cache ≈ 2 (key + value) × num_layers × hidden_dim × bytes_per_param × current_length
The engineering implication is direct: expanding the context window by 4× drops the serviceable concurrency to about a quarter. Long context is a memory budget problem, not a prompt-engineering trick. Complementary techniques include chunked caching, paged memory management, request batching, and—at the product level—separately rate-limiting and separately pricing extra-long inputs.
2.3 Three Capacity Strategy Bottom Lines
- Peak-valley asymmetry: Interactive traffic peak-to-valley ratios are often 5–10×, which static, prepaid annual/monthly resources struggle to cover at peak. You need a three-layer structure of “baseline resident + elastic supplement + burst reserve.”
- Tiered guarantees: Define service tiers for paid, trial, free, and internal batch traffic, prioritizing higher tiers at peak rather than letting all requests degrade together.
- Fault-domain isolation: Deploy across availability zones to avoid a single data center or single compute pool causing total unavailability; time-shift the reuse of training and inference resource pools.
3. Elastic Scaling: Driven by Queue Metrics, Not CPU Metrics
CPU utilization correlates weakly with inference latency (the bottleneck is GPU memory bandwidth and capacity), so scaling signals should switch to business and queue metrics.
Recommended scaling signals:
| Metric | Meaning | Suggested Action |
|---|---|---|
| Queue depth / queue wait time | Direct evidence that demand exceeds service capacity | Preferred scaling signal |
| Time-to-first-token P95 (TTFT) | Core of the interactive experience | Scale out when above threshold |
| Time-per-output-token P95 (TPOT) | Fluency of long outputs | Combine with batching parameter tuning |
| GPU memory utilization | Concurrency ceiling | Scale out immediately when near the limit |
| Degradation trigger rate | Protection mechanism being frequently invoked | Strong signal of chronically insufficient capacity |
Pseudo-config for the scaling strategy:
scaling:metric: queue_wait_time_p95 # not CPU utilizationtarget_value: 800msmin_replicas: 6 # floor, covers the daily baselinemax_replicas: 40 # hard cap, prevents runaway costscale_up:step: 100% # scale up aggressivelycooldown: 30sscale_down:step: 20% # scale down conservativelycooldown: 600s # avoid flapping and cache cold misses
Two easily overlooked details. First, scale up based on prediction rather than lagging metrics—use year-over-year/period-over-period comparisons, event calendars, and release windows for warm-up scaling; on model release day, capacity must be provisioned ahead of time. Second, scaling down is more dangerous than scaling up—frequent scale-downs cold-start caches that were just warmed, actually pushing up subsequent latency.
4. Graceful Degradation: Turning “Unavailable” into “Acceptable Suboptimal Experience”
Real stability design is not about rejecting overload but cutting compute cost in order from lowest to highest cost. It is recommended to implement an explicit degradation ladder:
from dataclasses import dataclassfrom typing import Callable@dataclassclass Level:name: strmax_output_tokens: intuse_lightweight_model: boolallow_multimodal: boolmessage: str | None = NoneLADDER = [Level("normal", 4096, False, True, None),Level("trim", 1024, False, True, None), # 1. Trim outputLevel("shortctx", 512, False, False, None), # 2. Truncate long contextLevel("lite", 512, True, False, None), # 3. Switch to lightweight modelLevel("queue", 256, True, False, "Peak load right now; you're queued, estimated wait 40 seconds"),Level("reject", 0, True, False, "Load is too high right now, please retry later"),]class Degrader:def __init__(self, load: dict, allow: Callable[[Level], bool]):self.load, self.allow = load, allowdef pick(self) -> Level:for lv in LADDER:if not self.allow(lv):continueif self.load["queue_wait_ms"] < 800 \and self.load["gpu_mem_ratio"] < 0.85 \and self.load["error_rate_5xx"] < 0.02:return lv # healthy, return to the best experiencereturn LADDER[-1] # fallback: explicit rejection rather than silent failure
Four complementary technical measures:
- Request admission and backpressure: An entry token bucket limits the number of concurrent sequences, immediately returning a 503 with
Retry-Afterwhen exceeded so clients back off and retry, instead of piling requests into memory until an avalanche. - Priority queue: Queue by service tier; at peak, batch and offline jobs proactively yield. Shifting batch jobs to valley periods is the lowest-cost way to scale.
- Result reuse: Cache results for frequently repeated questions and merge semantically similar requests; every 10-percentage-point increase in hit rate is equivalent to gaining 10% more compute out of thin air.
- Circuit breaking and timeout budgets: Set timeouts and circuit-breaker thresholds for each downstream call; fast failure is preferable to a long tail dragging down the entire chain.
5. Making Honest Communication a Product Capability, Not a PR Trick
Telling users “we’re looking for compute, feel free to use an alternative in the meantime” earns praise because it provides predictability. This can be fully productized in engineering:
- Explicit status: Distinguish “I’m thinking,” “I’m queued,” and “I’ve switched to lightweight mode,” so users know the difference comes from a protection mechanism, not the model getting dumber.
- Status page and proactive announcements: Publish service availability, degradation triggers, and recovery times, moving uncertainty from the user side to the operations side.
- Expectation alignment: When advertising performance ceilings, simultaneously disclose rate-limiting rules and concurrency constraints. Claiming capability without matching capacity costs a one-time loss of trust; admitting short-term limits earns long-term tolerance.
- Internal metrics loop: Bring degradation trigger rate and queue wait time into the team’s core dashboard; insufficient capacity must be a quantifiable, accountable, schedulable engineering item, not ad-hoc firefighting after each release.
6. Strategy: Shifting from “Buying Traffic” to “Buying Certainty”
Large-scale acquisition can bring users in once, but the compute experience determines whether they return. When customer acquisition cost exceeds retention cost, shifting budget from channels to inference stability and unit-economics optimization is a more rational resource allocation. Four actionable levers:
- Unit-economics accounting: Track token cost per active user, price by scenario difference, and identify high-consumption, low-value feature paths.
- Resource pooling and tidal scheduling: Protect interactive traffic by day, run batches at night, and time-shift shared compute pools for training and inference.
- Inference-side performance optimization: Quantization and low precision, operator fusion, batch scheduling, and speculative decoding can significantly boost throughput, often more cost-effectively than buying more compute.
- Elastic + reserve combination: Use long-term reserved resources at baseline to cut cost, and elastic resources at peak to protect experience, avoiding paying for the peak all year round.
7. Implementation Checklist
- Are you doing capacity planning with the output-token distribution rather than QPS?
- Have scaling signals switched to queue wait time and GPU memory utilization?
- Have you implemented at least three degradation levels, each with clear messaging?
- Does the entry point have admission rate-limiting and backpressure, returning a retryable signal when exceeded?
- Are long-context inputs separately rate-limited and separately priced?
- Have you configured a baseline + elastic + reserve three-layer capacity structure and deployed it across fault domains?
- Do you have result caching, and is its hit rate monitored?
- Does the product page explicitly state rate-limiting rules and degradation behavior?
In summary, insufficient compute is never a single-resource problem, but a coordination problem among capacity estimation, elastic scaling, degradation fallbacks, and expectation management. Make this chain solid, and service fluctuation at peak turns from an “outage incident” into “orderly protection by design.”
