LLM Inference Capacity Planning and Rate Limiting: A Practical Guide to Denominator Governance
This article explains why LLM inference capacity problems are often caused by an uncontrolled denominator—the compute, GPU memory, and context length consumed per request—rather than by call volume alone. It breaks down a per-request resource profile across four dimensions, outlines a three-tier rate limiting strategy with admission control, scheduling, and graceful degradation, and covers session lifecycle governance, prefix/semantic/result caching, and metrics-driven elastic scaling. The goal is to help developers lower per-call cost while preserving user experience.
1. Starting With a Common Pattern: The Denominator Problem Under Compute Pressure
A typical pattern has recently emerged in the industry: an AI chat service begins enforcing rate limits due to insufficient inference compute, and restricts long-running conversations that have been inactive from continuing to occupy resources. On the surface this looks like “not enough resources,” but the root cause is an uncontrolled denominator—what really determines cost and stability is not the numerator (call volume), but the denominator: the compute, GPU memory, and context length amortized across each call.
For developers, the signal from such incidents is clear: capacity planning for LLM services cannot look at QPS alone. The “per-request resource profile” must be treated as a first-class citizen in the design. Below is a complete analysis and implementation plan.
2. Breaking Down the Denominator: Four Dimensions of the Per-Request Resource Profile
To govern the denominator, you first need to measure it. The resource consumption of a single inference request can be abstracted into four dimensions:
- Context length: Input tokens and output tokens together determine the scale of attention computation, and the cost of long context typically grows non-linearly.
- Concurrency and batching shape: The burstiness of request arrivals determines batch size. Larger batches yield higher throughput but worse tail latency.
- Session lifecycle: Multi-turn conversations need to preserve session state, and long-inactive sessions continue to occupy GPU memory and cache.
- Model and precision configuration: Parameter scale, quantization precision, and whether speculative decoding is enabled all change the output per unit of compute.
Illustrative capacity estimation logic (pseudocode, expressing the idea only):
required_gpu = peak_qps * avg_tokens * cost_per_token / (gpu_throughput * target_utilization)session_memory = active_sessions * avg_context * bytes_per_token
A target_utilization with 20%~30% headroom is recommended to absorb burst traffic and failover.
3. Rate Limiting Is Not One-Size-Fits-All: Tiered Admission and Priority Queues
The correct goal of rate limiting is not to “reject users” but to “protect the denominator.” A three-layer strategy is recommended:
- Admission layer: Set token buckets by account tier and API type, so burst traffic goes through queuing rather than failing outright.
- Scheduling layer: Distinguish interactive requests from offline batch requests, prioritizing the former and using the latter to fill compute during off-peak periods.
- Degradation layer: When utilization exceeds a threshold, automatically shorten the maximum output length and disable non-essential long-context capabilities.
if utilization > 0.85:max_output_tokens = min(max_output_tokens, 512)enable_long_context = False
This kind of “predictable degradation” is friendlier to user experience than “unpredictable failure,” and is more easily accepted by upstream business teams.
4. Session Lifecycle Governance: Stop Inactive State From Consuming GPU Memory
Long conversations are expensive because state stays resident. Approaches include:
- Set an inactivity timeout, after which session state is serialized to external storage and restored when needed;
- Apply summary compression to historical turns, keeping only key constraints and the most recent turns verbatim;
- Use tiered caching: hot sessions stay in memory, warm sessions go to a cache service, and cold sessions land in object storage.
This preserves the multi-turn experience while compressing resident GPU memory into a controllable range.
5. Caching and Reuse: Increasing the Denominator’s “Effective Compute”
Requests with identical prefixes can reuse computed results. Three common types of reuse in engineering:
- Prefix caching: Fixed prefixes such as system prompts and tool descriptions are computed only once;
- Semantic caching: Return cached results for highly similar phrasings, with a similarity threshold and invalidation policy;
- Result caching: Directly cache outputs for deterministic tasks (such as fixed-template generation).
Note that caching introduces consistency risks, so invalidation and canary switches must be explicitly designed.
6. Elastic Scaling and a Closed Observability Loop
Scaling should be driven by metrics, not intuition. At minimum, collect: per-request token distribution, batch size, queue time, GPU memory usage, timeout rate, and number of degradation triggers. Build capacity watermark lines from these metrics, and combine them with the container platform’s elastic scaling and message queue peak shaving to form an “observe—predict—scale—review” loop.
For cloud deployment, you can combine a container platform to host inference instances, object storage to hold cold session data, and logging and monitoring/alerting services for diagnosis—gaining stable elastic capability without binding to a specific implementation.
7. Conclusion: Optimizing the Denominator Is the Long Game
Back to the denominator perspective: the real solution to compute pressure is not endlessly stacking GPUs, but making each call “cheaper”—shorter context, higher cache hit rate, more sensible batching, and stricter session reclamation. Push the denominator down, and the numerator (business growth) has room. For development teams, this governance framework can be embedded directly into the existing inference pipeline and iterated gradually, with measurable benefits and rollback-able risk.
