LLM Inference Scaling and Graceful Degradation: A Complete Guide to Capacity Planning and Observability
This article explains why production LLM inference services slow down, queue up, or crash under load, and why the root cause is rarely just a shortage of compute. It shows how to separate compute-bound from memory-bound bottlenecks, how continuous batching and KV cache reuse improve efficiency, how to design tiered degradation levels, how to estimate the number of GPUs you actually need from measured throughput, and which observability metrics and alert thresholds to track. It also outlines a safe rollout process and the risks of high-impact operations such as memory reclaiming, instance restarts, and cache clearing. The goal is a repeatable method for keeping inference services stable through traffic spikes, longer contexts, and instance failures.
Introduction: It’s Not Just About Adding GPUs — It’s About Making Inference Survive, Degrade Gracefully, and Stay Visible
Once large model inference moves into production, many teams run into the same pattern: the API responds normally under everyday traffic, but as soon as traffic climbs, inputs get longer, or concurrency rises, requests start to queue. Then come timeouts, rate limiting, and even instance crashes. On the surface this looks like “not enough compute,” but in practice the real cause is usually that capacity estimation, scheduling strategy, memory management, and degradation mechanisms never formed a closed loop.
This article is written for inference service developers, SREs, AI platform teams, and backend architects. The goal is not to promise linear scaling, but to lay out a practical approach: identify bottlenecks, estimate capacity, optimize scheduling, set up a degradation ladder, build observability metrics, and put risk controls in place before high-risk operations such as scaling, restarts, and cache clearing.
1. Why Requests Get Throttled: Separate Compute Bottlenecks from Memory Bottlenecks
An LLM inference request usually consists of two phases: prefill and decode. Prefill processes the input prompt and is compute-intensive; decode generates tokens one at a time and is often constrained by memory bandwidth and KV cache occupancy. Mixing these two together makes capacity estimation misleading.
1.1 Compute-Bound Scenarios
Compute-bound situations typically occur when a large number of input tokens must be processed in parallel, batch sizes are large, and matrix multiplications saturate the GPU’s compute units. Common triggers include:
- Long input prompts arriving in bursts, such as document summarization, code completion, and long-context RAG.
- A high total token count within a batch, pushing GPU utilization close to saturation.
- A large model without effective quantization, making per-token compute expensive.
- Improper scheduling when chunked prefill is enabled, causing prefill and decode to compete for resources.
How to identify it: watch GPU utilization, SM activity, prefill throughput, and end-to-end latency. If GPU compute utilization is high and input throughput is near its ceiling while memory still has headroom, the bottleneck is usually compute.
1.2 Memory/Bandwidth-Bound Scenarios
During decode, generating each token may require reading the model weights and a large amount of KV cache. When memory approaches its limit, KV cache occupancy is too high, and memory bandwidth is saturated, throughput drops even if GPU compute utilization is low. Common triggers include:
- Long contexts causing KV cache to grow rapidly.
- Too many concurrent sessions, making PagedAttention or continuous batching hard to schedule.
- Model weights consuming too much memory, leaving insufficient space for KV cache.
- Frequent instance restarts, cache clearing, or insufficient warm-up, causing short-term performance jitter.
How to identify it: watch memory usage, KV cache occupancy, memory bandwidth utilization, TPOT/ITL, and queueing delay. If memory usage stays above 85% while GPU compute utilization is low, suspect a memory or bandwidth bottleneck first.
1.3 Comparing the Two Bottleneck Types
| Bottleneck Type | Trigger Scenario | Typical Symptoms | Scaling / Optimization Direction |
|---|---|---|---|
| Compute-bound | Long inputs, high batch, large token volume | High GPU utilization, high prefill latency | Add compute, tune batching, quantize, chunked prefill |
| Memory/bandwidth-bound | Long contexts, high concurrency, high KV cache | High memory, low throughput, high TPOT | Add memory, reduce context, switch to a smaller model, optimize caching |
| Scheduling bottleneck | Long-tail requests, queue backlog | GPU utilization and throughput don’t match | Continuous batching, priority scheduling, tiered degradation |
2. Core Mechanisms: Continuous Batching, KV Cache Reuse, and Tiered Degradation
2.1 Continuous Batching: The Key to Higher GPU Utilization
Continuous batching does not simply pack requests into one static batch; it schedules requests dynamically at iteration granularity. When a request finishes generating, its freed slot can be immediately filled by a new request, reducing waiting and idle time.
In production, keep an eye on the following parameters, but the specific values must be tuned through load testing:
| Parameter | Meaning | Tuning Guidance |
|---|---|---|
| max_num_seqs | Max concurrent requests per batch | Set based on memory and throughput goals; too high increases queueing and tail latency |
| max_num_batched_tokens | Max tokens per batch | Balance throughput and latency; avoid overloading a single scheduling pass |
| enable_chunked_prefill | Split long prefill into chunks | Good for long-input scenarios; reduces how much long requests block short ones |
| gpu_memory_utilization | Fraction of memory to use | Reserve a safety margin to avoid OOM |
| block_size | KV cache block size | Adjust alongside the model and framework recommendations |
Continuous batching suits scenarios with high concurrency and a mix of long and short requests. If your workload is entirely very long outputs, you still need to evaluate memory and latency separately and cannot rely on batching alone.
2.2 KV Cache Reuse: Cutting Repeated Compute Costs
KV cache reuse is mainly suited to scenarios where prefixes are identical or highly similar, such as fixed system prompts, RAG retrieval prefixes, multi-turn conversation history, and batch tasks that share the same template. Using prefix caching, PagedAttention, or block-level hashing, you can reuse existing KV cache and reduce repeated prefill overhead.
Reuse does come with boundaries to respect:
- Identical prefixes must match byte-for-byte or after normalization, otherwise the hit rate will be very low.
- Dynamically concatenated user input should not be placed in a reusable prefix.
- In multi-tenant scenarios, isolate cache namespaces to prevent unauthorized reads.
- Cache clearing and instance restarts will temporarily lower the hit rate.
2.3 Tiered Degradation: Protecting the Core Experience When Capacity Falls Short
Degradation does not mean rejecting every request; it means releasing pressure step by step according to impact. Set up clear levels, thresholds, and rollback mechanisms.
| Degradation Level | Action | Example Trigger Threshold | Impact on SLA | Rollback |
|---|---|---|---|---|
| L0 Normal | Keep current configuration | No anomalies | None | Not needed |
| L1 Reduce max_tokens | Cap the maximum output length | TPOT P95 rises, queue grows | Output may be incomplete | Restore the parameter |
| L2 Reduce concurrent batch | Lower max concurrency or throttle | KV cache > 85%, memory nearing its limit | Queueing increases | Ramp traffic back up gradually |
| L3 Shorten context | Compress history or retrieved content | TTFT P95 exceeded, long requests blocked | Weaker answer context | Restore the context strategy |
| L4 Switch to a smaller model | Route to a smaller model | Error or timeout rate keeps rising | Quality may drop | Switch back to the main model |
| L5 Queue/reject | Return 429 or an async task | System overloaded for a sustained period | Some requests fail | Recover as traffic subsides |
Thresholds cannot be copied directly; they must be calibrated against your business SLA. For example, online customer-service chat can tolerate more queueing, while real-time recommendations or code completion are far more sensitive to TTFT.
3. Capacity Estimation: Deriving the Number of GPUs You Need from Measured Throughput
3.1 The Basic Formula
Before scaling, you must run load tests to obtain “measured single-GPU throughput.” Recommended formulas:
Required GPUs = ceil(peak QPS ÷ measured single-GPU QPS × redundancy factor)
If you estimate along the token dimension, you can use:
Required GPUs = ceil(peak QPS × average tokens per request × redundancy factor ÷ single-GPU tokens processed per second)
Where:
average tokens per request = average input tokens + average output tokens
Set the redundancy factor to 1.2–1.8 initially. Use a higher value when traffic is volatile, the long tail is pronounced, or the SLA is strict.
3.2 The Benchmark Methodology Must Be Documented
If you only write “measured throughput” without the measurement methodology, your capacity conclusions are not reproducible. A benchmark record should include at least:
- Model size and version, e.g., 7B, 13B, 70B.
- Quantization method, e.g., FP16, BF16, INT8, AWQ, GPTQ.
- Inference framework and version, e.g., vLLM, TGI, SGLang, or a custom service.
- GPU model, memory size, node count, and network topology.
- Input/output length distribution, e.g., P50/P95 input 1k/4k, output 256/1024.
- Concurrency strategy, e.g., 8, 16, 32, 64 concurrent.
- Sampling parameters, e.g., temperature, top_p, max_tokens.
- Whether prefix caching, chunked prefill, and tensor parallelism are enabled.
3.3 Estimation Example
Suppose peak traffic is 40 QPS, average input is 1024 tokens, average output is 512 tokens, measured single-GPU throughput is 6 QPS in the 1k/512 scenario, and the redundancy factor is 1.5.
Then required GPUs = ceil(40 ÷ 6 × 1.5) = 10 GPUs.
If the proportion of long-text requests is high, single-GPU QPS drops and the number of GPUs you need rises; if effective prefix caching is enabled, actual prefill overhead drops, but you must recalibrate using the cache hit rate.
4. Observability: Without Metrics There Is No Scaling or Degradation
4.1 Core Metrics Checklist
| Metric | Meaning | Collection Guidance |
|---|---|---|
| TTFT | Time to first token | Instrument at the gateway or inference service |
| TPOT/ITL | Per-token generation latency | Inference engine metrics |
| End-to-end latency | Total request time | Jointly collected at the gateway, client, and APM |
| Queueing delay | Wait time after a request enters the inference queue | Scheduler metrics |
| GPU utilization | Compute resource usage | DCGM, Prometheus |
| GPU memory utilization | Memory occupancy and fragmentation | DCGM, engine metrics |
| KV cache occupancy | Cache slot and block usage | Inference engine metrics |
| Batch size | Current scheduled batch scale | Inference engine metrics |
| Throughput | tokens/s or QPS | Server-side and benchmark reports |
| Degradation rate | Proportion of requests that triggered degradation | Gateway and policy center |
| Drop rate / 429 ratio | Proportion of rejected requests | Gateway metrics |
| OOM / restart count | Stability signal | Container and host monitoring |
4.2 Example Alert Thresholds
Thresholds must be calibrated per business; the following are general starting points:
- TTFT P95 exceeds 5 seconds for 5 consecutive minutes: trigger a capacity check.
- TPOT P95 rises noticeably, e.g., up 50% from baseline: trigger a memory and batch check.
- GPU memory utilization exceeds 90% for 10 consecutive minutes: trigger scaling or degradation.
- KV cache occupancy exceeds 85%: trigger context compression or concurrency limits.
- Queued requests stay above 50: trigger throttling or degradation.
- Degradation rate exceeds 5%: trigger a manual review.
- 5xx or 429 ratio exceeds 2%: trigger emergency scaling or traffic rerouting.
5. Rollout Process and Risk Warnings
5.1 Recommended Rollout Process
- Establish a baseline load test, recording throughput, latency, memory, and error rate.
- Calculate capacity with redundancy, leaving a buffer for traffic bursts.
- Do a canary release, initially taking 5%–10% of traffic.
- Observe TTFT, TPOT, KV cache, and degradation rate for 24 hours.
- Ramp traffic up gradually, with automatic alerts and rollback scripts configured.
5.2 High-Risk Operation Warnings
For memory reclaiming, instance restarts, KV cache clearing, and model hot-swapping, you must assess the impact in advance:
- These may interrupt in-flight requests, so configure graceful shutdown and connection draining.
- They may temporarily lower the cache hit rate, causing throughput to dip briefly.
- They may cause multi-turn conversation context to be lost, so the business side should support retries or context replenishment.
- Prefer rolling releases, batched restarts, canary traffic, and fast rollback.
6. FAQ
Why does LLM inference get throttled?
Common causes include: traffic spikes exceeding capacity, long contexts inflating the KV cache, unreasonable batching strategy, insufficient GPU memory, queue backlog in the scheduler, and temporary capacity drops from instance restarts or cache clearing.
Should I scale up or degrade?
If traffic grows over the long term and cost is acceptable, prioritize scaling up; if it’s a short-term burst, cost is sensitive, or memory is tight, degrade first. Degradation should protect core requests first, then handle non-core or low-priority traffic.
What are common performance misconceptions?
Misconception 1: looking only at GPU utilization. Under a memory bottleneck, GPU compute utilization may not be high. Misconception 2: assuming bigger batches are always better. Oversized batches may raise throughput but lengthen tail latency. Misconception 3: ignoring the difference in input and output lengths. Throughput varies greatly across different length combinations. Misconception 4: ignoring the KV cache. In long-context scenarios, insufficient memory can directly bring the service down.
Should I prioritize quantization?
Quantization can reduce memory usage and improve throughput, but it may affect generation quality. Before going live, run quality regression tests and stability load tests; do not switch to production without evaluation.
7. Summary
LLM inference scaling is not simply adding GPUs; it is systems engineering that combines capacity estimation, scheduling optimization, memory management, observability, and degradation with rollback. Teams should first distinguish compute bottlenecks from memory bottlenecks, then use continuous batching, KV cache reuse, and tiered degradation to improve efficiency, and finally close the loop with measured throughput and metric monitoring. An inference service built this way can stay stable through traffic fluctuations, longer contexts, and instance failures, while retaining controlled scaling and rollback capabilities.
