LLM Inference at Scale: Overcoming Compute Bottlenecks Under High Concurrency
This article examines why large-scale LLM services hit compute and memory limits as traffic grows, and how to respond. It covers the technical causes of performance degradation and partial outages—GPU memory as the first constraint, queueing-driven retry storms, and batch imbalance from mixed short and long requests—then walks through five practical mitigation paths: benchmark-driven capacity planning, inference-side cost and efficiency gains, elastic scheduling with tiered resource pools, graceful degradation and fault isolation, and observability with capacity watermark management. Includes illustrative benchmark pseudocode, a scaling policy example, and a client-side retry checklist.
1. Background: Compute Supply Pressure Driven by User Growth
When a large model application reaches hundreds of millions of monthly active users, the server side is no longer dealing with a single-point problem of “model quality.” It becomes a systems engineering problem: can the request peak within a given time window be absorbed reliably? Public information shows that after one large model service’s user base kept climbing, its official status records showed repeated service incidents, mostly performance degradation, plus several partial interruptions on the web client or API.
These are not isolated failures but the inevitable result of a mismatch between capacity and traffic structure. Understanding the causes is the first step toward designing a stable inference service.
1.1 Asymmetric Traffic Structure
Requests to large model services are clearly asymmetric: a small number of requests consume very long decoding times, while a large number only process short inputs. If the scheduling layer throttles by “request count” rather than “resource usage,” a few long requests will occupy inference slots for extended periods and subsequent requests will queue until they time out.
1.2 Peak-to-Trough Ratio vs. Resource Utilization
Provisioning compute for the peak leaves large amounts idle during troughs; provisioning for the average guarantees overload at the peak. This is the tradeoff every online inference system faces, and the fundamental reason elastic scheduling exists.
2. Technical Causes of Performance Degradation and Partial Interruptions
2.1 GPU Memory Becomes the First Constraint
The core bottleneck during inference is usually not peak compute but GPU memory capacity and bandwidth. The key-value cache grows linearly with concurrency and context length; once it approaches the limit, the scheduler can only reject new requests or trigger swapping, which shows up as slower responses and a higher error rate.
2.2 Avalanches Through a Queueing Theory Lens
When the arrival rate exceeds the service rate, queue length grows without bound and wait time rises nonlinearly. If clients are widely configured to retry, retry traffic further amplifies the load, creating a positive feedback avalanche.
2.3 Long Contexts Conflict with Batch Efficiency
Large batches improve throughput, but mixing long and short requests in the same batch causes serious compute waste. This is the intra-batch imbalance problem widely discussed in the industry.
3. Path One: Capacity Planning and Benchmark Baselines
Capacity planning must be built on reproducible benchmark data, not experience-based estimates. At minimum, cover the following dimensions:
- Input/output length distributions (not just average length)
- Concurrent session counts with percentile values for time-to-first-token and overall latency
- The GPU memory growth curve versus concurrency, and its inflection point
Illustrative benchmark call logic (pseudocode):
# Use percentile latency and the GPU memory inflection point as the capacity baselinefor concurrency in [10, 50, 100, 200, 400]:stats = run_benchmark(concurrency=concurrency,input_len_dist=INPUT_DIST, # real length distributionoutput_len_dist=OUTPUT_DIST,)print(concurrency, stats.p95_latency, stats.gpu_mem_peak)if stats.p95_latency > SLO or stats.gpu_mem_peak > MEM_SAFE:capacity_limit = concurrencybreak
The key principle: find whichever inflection point appears first—“percentile latency exceeds target” or “GPU memory reaches the safe watermark”—and treat it as the safe capacity of a single node.
4. Path Two: Cost and Efficiency Gains on the Inference Side
- Key-value cache reuse: prefix caching for identical prefixes (system prompts, fixed documents) can significantly reduce repeated computation.
- Continuous batching: replace request-level scheduling with iteration-level scheduling so new requests can be inserted into free slots at any time.
- Quantization and sparsification: reduce the GPU memory footprint of weights and cache within an acceptable accuracy range.
- Output length governance: set reasonable upper limits and return overlong generations in segmented streaming responses, avoiding a single request holding resources for a long time.
5. Path Three: Elastic Scheduling and Tiered Resource Pools
Stable services typically have tiered resource pools: a low-latency pool handles interactive short requests, and a high-throughput pool handles long-text and batch jobs. The two are isolated through queues and priorities so they do not interfere with each other. On the cloud, you can combine a container platform for horizontal scaling, a message queue for peak shaving and trough filling, object storage for long text and result persistence, and monitoring, alerting, and logging services to close the loop.
# Illustrative: scaling policy based on latency and queue depthscale_policy:metric: p95_latency_ms # or queue wait timetarget: 800min_replicas: 4max_replicas: 40cooldown_seconds: 120 # prevent flapping scale actions
It is worth stressing that scaling has cold-start and model-loading overhead, so you must reserve buffer capacity and pair it with warm-up rather than scaling out only after overload occurs.
6. Path Four: Graceful Degradation and Fault Isolation
Degradation is not failure but a controlled tradeoff. Common strategies include:
- Shorten the maximum output length and prioritize returning the first token;
- Disable non-core inference enhancements during peaks and keep basic conversation;
- Switch non-critical tasks to asynchronous processing and defer execution through a queue;
- Isolate circuit breaking and rate limiting per tenant so a single source cannot saturate global resources.
The client side matters just as much: use exponential backoff with jitter for retries, set reasonable timeouts, and avoid immediate retries after failure that cause a secondary impact.
7. Path Five: Observability and Capacity Watermark Management
Without measurement there is no capacity governance. At minimum, collect request arrival rate, queue wait time, batch size distribution, GPU memory and cache hit rate, percentile latency, and error code distribution, and set tiered alerts on “watermarks” (attention, warning, forced throttling). Only when the watermark runs below the safe line for a sustained period is there headroom to absorb traffic spikes.
8. Conclusion
Compute pressure at the scale of hundreds of millions of users is essentially an ongoing contest between “deterministic capacity” and “random traffic.” The workable solution is not simply piling on compute, but combining capacity baselines, inference acceleration, elastic scheduling, degradation plans, and an observability system into one engineering loop. For enterprises preparing to deploy inference services on cloud environments such as Baidu AI Cloud, the pragmatic path that balances cost and stability is to first use data to determine the safe watermark, then use architecture to buy elasticity.
