LLM Serving Under High Concurrency: Why Services Crash and How to Build Stability
This article explains why large language model services fail under high concurrency and how to build stability against it. It reframes outages as measurable capacity problems, shows why token throughput—not QPS—must drive capacity planning, and covers the supply-side constraints of compute delivery. It then presents practical stability measures: inference resource pooling and batch scheduling, multi-level rate limiting and graceful degradation, token-level observability and predictive alerting, and cost-and-experience balancing through transparent pricing. A final checklist summarizes the engineering actions needed to keep LLM services available under load.
1. Framing the Problem: Turning “Service Crashes” into Measurable Engineering Questions
When an LLM service repeatedly becomes unavailable over a short period, discussions easily devolve into arguments about whether the fault lies with users or the platform. From an engineering perspective, however, almost all such incidents reduce to three measurable questions: whether the request arrival rate within a given time window exceeds the system’s throughput ceiling; whether the per-request resource cost (especially the duration of GPU memory and compute occupancy) is accurately accounted for in the capacity model; and whether the system degrades gracefully or fails hard under overload.
A common misjudgment is to treat an LLM service like a traditional stateless web service and scale it the same way. Scaling a traditional service has a roughly linear marginal cost, whereas every LLM inference request occupies GPU memory and holds a block of non-interruptible compute time, and requests with different input and output lengths vary enormously in resource consumption. So “users are using it too much” is not the cause; the real cause is that the capacity model does not account for tokens as a first-class resource.
2. What Actually Changed on the Demand Side: From “Call Counts” to “Token Consumption”
The original discussion noted that after a certain class of intelligent coding tools (commonly known in the industry as coding assistants or task-orchestration harnesses) appeared, token consumption grew by roughly 3x within about a month. The mechanism behind this is worth unpacking:
- The calling agent shifted from humans to programs. Previously one session mapped to one request; now a single development task is decomposed into multiple rounds of “read file—retrieve—generate—validate—retry,” and the request count grows in a fan-out pattern.
- Context is carried repeatedly. To help the model understand the repository structure, long contexts are reassembled into every call, so input tokens accumulate linearly or even super-linearly across rounds.
- Retries amplify traffic. A single timeout often triggers a client retry, and without backoff and idempotency controls, retries turn into self-inflicted traffic spikes.
The conclusion is direct: the denominator of capacity planning must change from QPS to token/s (input + output), and it must distinguish “peak token rate” from “average daily token volume.” An illustrative capacity calculation can be written as:
Required concurrent batch scale ≈ peak token rate / effective per-GPU throughput (token/s)Effective per-GPU throughput = theoretical compute throughput × batch efficiency × GPU memory bandwidth derating factorSafety margin = 1 / (1 - target headroom) # e.g., 30% target headroom means dividing by 0.7
3. Supply-Side Constraints: Compute Delivery and Data Center Build Cycles
Scaling an LLM service is not “click a button.” It is bound by three hard constraints: accelerator production capacity and delivery lead time, the construction cycle for facilities, power, and cooling, and the tuning cycle after a cluster goes live. These three chains typically deliver on a quarterly cadence, while demand growth can be weekly. When month-over-month demand growth reaches several times per month, any static cluster will inevitably be overwhelmed.
Therefore, attributing the stability problem entirely to the supply side is incomplete; attributing it entirely to the demand side is equally untenable. The only viable engineering path is to accept that growth rates are uncontrollable and to build the system into a form that “does not crash even under overload.”
4. Stability Measure One: Inference Resource Pooling and Batch Scheduling
The core idea is to aggregate scattered requests into batches to raise output per unit of compute, while using queues to absorb bursts.
- Continuous batching: rather than waiting for a whole batch to finish, new requests are inserted into free slots at any time, significantly reducing queueing latency.
- Separate pools by input/output length: route long-context requests and short requests to different resource pools to prevent long requests from blocking short ones (head-of-line blocking).
- KV cache reuse: share prefix caching for identical prefixes (such as system prompts and repository descriptions) to cut repeated prefill overhead.
- Priority queues: prioritize paid/interactive requests, and give offline batch jobs lower priority with preemption allowed.
# Illustrative: scheduling skeleton with priority and length-based poolingdef schedule(req, pools):pool = pools["long"] if req.input_tokens > 8000 else pools["short"]if pool.queue_depth() > pool.max_queue:return reject_or_degrade(req) # fast failure beats infinite queuingreturn pool.submit(req, priority=req.priority)
5. Stability Measure Two: Multi-Level Rate Limiting, Queuing, and Graceful Degradation
Under overload, a hard “5xx” is the worst experience; a four-tier strategy should absorb it layer by layer:
- Ingress rate limiting: apply token buckets across three dimensions—tenant, endpoint, and token rate—and return a message with a retry hint for anything over the limit.
- Queuing and timeout budget: set an end-to-end deadline for each request, and fail immediately if queue wait exceeds the budget, avoiding wasted compute from requests “cut off halfway.”
- Degradation: disable non-core capabilities (such as ultra-long context and deep reasoning modes), keep basic conversation, and return fallback results from a smaller model.
- Client coordination: enforce exponential backoff with jitter, have the server return
Retry-After, and deduplicate repeated submissions with an idempotency key.
HTTP/1.1 429 Too Many RequestsRetry-After: 3X-RateLimit-Remaining-Tokens: 0
6. Observability and Capacity Early Warning: Making Crashes Predictable
Without token-level monitoring, capacity problems can only be reviewed after the fact. A minimal viable metric set includes: ingress QPS, input/output token rate, queue depth and wait-time distribution (P50/P95/P99), actual batch size, GPU memory usage and fragmentation rate, cache hit rate, and the share of each error type. Alerts should be based on predictive indicators rather than error rate alone—for example, a sustained rise in queue depth, P99 wait time breaching budget, or a sudden drop in cache hit rate are all precursor signals of a crash.
At the same time, establish regular load testing and chaos drills: simulate batch offline of accelerator nodes, simulate a several-fold traffic surge, and simulate a spike in the share of long-context requests, to verify that the degradation paths actually work.
7. Balancing Cost and Experience: Turning the Revenue-Share Dispute into a Pricing Design Problem
The original discussion also mentioned dissatisfaction over cost pass-through and platform revenue sharing. The engineering answer is to make the cost structure transparent and put the choice in users’ hands. Common, general practices include: billing by token with a usage dashboard; offering low-cost batch/offline channels; giving discounts on cache-hit portions; and providing resource reservation and quota management on the enterprise side. These all fall under general cloud capability categories common in the industry (such as container platforms, message queues, object storage, log services, and monitoring and alerting), which can be delivered by cloud platforms such as Baidu AI Cloud as general-purpose products rather than relying on any single proprietary interface.
8. Implementation Checklist
- Change the capacity unit from QPS to token/s, and build a dual-track model for peak and daily average;
- Roll out continuous batching + length-based pooling + prefix caching;
- Implement three-tier rate limiting and deadline budgets to eliminate wasted queuing;
- Build token-level monitoring and predictive alerting, and make quarterly load testing routine;
- Design elastic scaling policies and define the lead time and reservation mechanism for scaling out;
- Externally provide usage transparency and degradation options to reduce experience gaps.
Summary: a service becoming unavailable under high concurrency is fundamentally a problem of the capacity model and overload design, not of users “using it too hard.” Treating tokens as a first-class resource, making overload degradation a default capability, and building observability ahead of the crash are the sustainable engineering answers.
