LLM Capacity Planning and Service Rate Limiting Under Compute Constraints
This article explains why more capable large language models often create tighter capacity, and how to plan for it. It breaks down the two phases of online inference, why peak concurrency depends on GPU memory and scheduling efficiency rather than raw compute, and how KV cache eviction, tiering, and prefix reuse trade space for latency. It also covers multi-dimensional admission control, rate limiting, prioritization, graceful degradation, and a four-layer capacity model built on observability, load testing, elastic scaling, and cost governance. A practical checklist for teams is included.
1. The Resource Reality Behind the Outage: Why “More Powerful” Often Means “Tighter”
A major jump in model capability usually comes with a significant increase in compute consumed per request. When new subscriptions are temporarily closed, the outside world sees a product decision; the engineering side sees a capacity watermark alert. To understand this, you first need a resource model for large-model online inference.
Online inference typically has two phases:
- Prefill: processes the entire input prompt at once. It is compute-intensive and mainly consumes compute.
- Decode: generates tokens autoregressively, one at a time. It is mainly constrained by memory bandwidth and cache capacity.
So what determines “how many users can be served at the same moment” is not a single number like a card’s theoretical peak compute, but a composite ceiling formed by memory capacity, memory bandwidth, compute utilization, and scheduling efficiency. A stronger model, longer context, and more verbose output all raise per-request resource usage at the same time. That is the intrinsic link between capability upgrades and capacity pressure.
2. First Principles of the Concurrency Ceiling: Treat the GPU as a High-Speed Pipeline
You can abstract the decode process as a pipeline: take one user’s request, load its context cache, keep producing tokens; when generation ends, release the cache and load the next user.
Illustrative scheduling logic (conceptual only, not a concrete API):
while cluster_alive:batch = scheduler.take_pending_requests()if memory_watermark > high_threshold:drop_or_offload_some_idle_session_caches()batch = form_batch(batch, target_batch_size)output = inference_engine.forward(batch)stream_return(output)if request_finished:release_its_cache_and_slot()
This yields three engineering conclusions:
- Peak concurrency is roughly proportional to available memory and scheduling efficiency, not simply to compute.
- The key to higher throughput is batching and pipeline overlap, keeping compute units from idling.
- Caches can be dropped, but the cost of “recomputation” must be modeled explicitly; otherwise you turn a capacity problem into a latency problem.
3. KV Cache: Droppable, but Not Free
Session caches become a scheduling lever because online conversation reuse is naturally low: many requests are one-off short Q&A, and long sessions are rarely iterated repeatedly within the same day. So “free the cache first, recompute later” becomes a common tradeoff.
In engineering, this is usually handled in three tiers:
- Direct drop: full recomputation when the user returns. Simplest to implement, but latency jitter is noticeable for long-prompt scenarios.
- Tiered offload: hot data stays in memory, warm data goes to system memory, cold data lands on object storage or local disk, migrated back by access heat.
- Prefix reuse: shared caching for common prefixes such as system prompts and long documents, significantly reducing repeated computation.
A simplified admission and eviction strategy can be written as:
def admit(request, state):need = estimate_kv_bytes(request)if state.free_bytes >= need:return "run"victims = pick_idle_sessions(state, exclude=request.session_id)for v in victims:state.evict(v, tier="disk") # offload instead of dropping outrightreturn "run" if state.free_bytes >= need else "queue"
The key point: the offload strategy must be tied to business SLAs. For latency-sensitive interactive scenarios, it is better to queue than to repeatedly recompute on long contexts; for offline batch scenarios, aggressive dropping can be used to trade for higher throughput.
4. Rate Limiting and Prioritization: Allocate Scarce Resources to Those Who Should Be Served First
When capacity is insufficient, a crude “one-size-fits-all” cut directly hurts experience. A more robust approach is multi-dimensional admission control:
- Priority tiers: interactive online requests take precedence over batch offline tasks.
- Quotas and token buckets: limit requests per unit time and concurrency per user or tenant, preventing individual hotspots from crowding out the whole.
- Queues and timeouts: set queue limits and fast failure, returning clear status and retry guidance.
- Graceful degradation: during peaks, shorten max output length, lower the context limit, switch to a smaller model.
Pseudocode example:
if not limiter.allow(user_id, tokens=est_tokens):return {"code": "rate_limited", "retry_after": 30}if queue.depth() > MAX_QUEUE:return degrade(response_mode="short", max_output=512)
It is worth emphasizing: protecting existing users takes priority over opening up new volume. Keeping existing plans available, allowing renewals and smooth plan upgrades, and tying the opening time of new plans to technical scaling progress is a more responsible product-engineering strategy than a “limited-time flash sale.”
5. Capacity Planning: From Firefighting to Pre-Event Modeling
A sustainable capacity system includes at least four layers of capability:
- Observability: collect concurrency, queue time, time-to-first-token, per-token generation time, memory and cache hit rate, and close the loop via logging services and monitoring alerts.
- Load testing and capacity modeling: use real traffic profiles for stepped load tests, fit the “concurrency–latency–throughput” curve, and find the inflection point rather than the average.
- Elastic scaling: run inference services on a container platform, scale based on queue depth and latency metrics, and reserve time for cold starts and model loading.
- Cost governance: separate compute pools by business value, run offline tasks on low-priority resources, and guarantee dedicated capacity for online tasks.
For scaling cadence, small steps and fast iteration are recommended: expand cache and scheduling capability first, then compute; protect existing users first, then open to new ones; and regression-test each scaling tier with the same load-test script.
6. An Actionable Checklist for Teams
- Define a per-request resource profile: input length distribution, output length distribution, cache hit rate.
- Set tiered SLAs: define latency and availability targets separately for online interaction and offline tasks.
- Establish three-tier degradation plans: shorten output, limit context, switch to a smaller model.
- Bind cache strategy to business: droppable, offloadable, shareable prefixes, chosen by scenario.
- Treat “pausing new sign-ups” as a capacity signal rather than a marketing event, and use data to drive scaling and opening cadence.
In summary, every leap in a high-performance model redefines the capacity boundary. The truly mature approach is to treat compute as a scarce resource that needs fine-grained scheduling: trade space for cache management, throughput for batching and pipelining, stability for rate limiting and degradation, and predictability for observability and load testing. Baidu AI Cloud’s combination of general capabilities in container platforms, object storage, logging services, and monitoring alerts is a common technical foundation for supporting this kind of online inference capacity system.
