High-Concurrency LLM Inference: A Practical Guide to Capacity, Optimization, and Cost Control

    This article turns the signal from LLM API usage leaderboards into an engineering playbook for high-concurrency inference. It explains why token throughput, not QPS, should be the unit of capacity planning; how to apply continuous batching, prefix and semantic caching, and tiered routing across light and strong models; and how to build stability, observability, and cost attribution through layered rate limiting, graceful degradation, bounded retries, SLO burn-rate alerts, and per-tenant tagging. A four-stage rollout path helps teams put these practices into production.

    1. What the Usage Rankings Mean for Engineering

    Public data shows that a class of general-purpose LLM services has held the top spot on global aggregated calling platforms for thirty consecutive weeks. Leading models have dominated for multiple weeks, processing tens of trillions of tokens per week while still growing at double-digit rates week over week. At the same time, newly launched lightweight model versions have grown several times faster—sometimes tens of times faster—month over month, with some new entries on monthly charts posting processing-volume increases above 999%.

    This article cites no specific vendor, product model, or platform name. The numbers are read purely as industry signals. For developers, the rankings carry three messages:

    1. Inference traffic has overtaken training as the main cost center. Once weekly volume reaches the trillion-token scale, the marginal cost, queueing latency, and failure rate of a single request are amplified into overall billing and user-experience problems.
    2. Model supply follows a “one leader, many strong contenders, rapid iteration” pattern. Leading models hold the majority share, while lightweight models enter developers’ view at extremely high growth rates. This shows that “tiered selection by task” is becoming the default practice.
    3. Call volume is highly volatile, so capacity must be elastic. Week-over-week swings of ±16% and month-over-month growth of several times are normal. Static resource planning inevitably leads to either waste or collapse.

    2. Capacity Planning: Treat Tokens as a First-Class Resource Unit

    Traditional services use QPS as the capacity unit, but the real load of an LLM service is a combination of input tokens + output tokens. At the same QPS, a long input document and a short question can differ in resource consumption by one to two orders of magnitude.

    It is recommended to explicitly distinguish four metrics in the capacity model:

    • Input token rate (prompt tokens/s)
    • Output token rate (completion tokens/s)
    • Concurrent in-flight requests
    • Time to first token (TTFT) and overall latency (TPOT, time per output token)

    A simplified capacity estimation example (illustrating the method only, not real parameters):

    1. # Capacity estimation example: benchmark on token throughput, not QPS
    2. def estimate_capacity(req_per_sec, avg_in_tokens, avg_out_tokens, safety=1.3):
    3. in_rate = req_per_sec * avg_in_tokens
    4. out_rate = req_per_sec * avg_out_tokens
    5. # Memory and compute budgets must cover peaks, not averages
    6. peak_in = in_rate * safety
    7. peak_out = out_rate * safety
    8. return {"prompt_tokens_per_sec": peak_in,
    9. "completion_tokens_per_sec": peak_out}

    The key is to budget with a peak factor rather than averages, and to set separate SLOs for TTFT and TPOT. For long-input scenarios, prioritize TTFT (caching, prefix reuse); for long-output scenarios, prioritize TPOT (batch size, decoding strategy).

    3. Inference Optimization: Batching, Caching, and Tiered Routing

    3.1 Continuous Batching and Dynamic Batch Size

    Static batching makes short requests wait for long ones, causing head-of-line blocking. The industry commonly adopts continuous batching: a slot is released as soon as a request completes, and a new request is inserted immediately. In practice, you need a trade-off between maximum batch size and maximum wait window:

    1. If accumulated tokens within the wait window < batch threshold and queue is non-empty → keep waiting
    2. Otherwise → form a batch and execute immediately

    A larger batch yields higher throughput but raises TPOT. Therefore, the batch threshold should adjust dynamically with SLOs rather than remain a fixed constant.

    3.2 Prefix Caching and Semantic Caching

    Many business requests share the same system prompt or knowledge context, and prefix caching can significantly reduce repeated computation. Adding a semantic cache layer (matching similar phrasings to historical answers) can cut duplicate calls. Note two points: the cache key must include the model version and key parameters to avoid “cross-contamination”; and the semantic cache needs a similarity threshold and expiration policy to prevent incorrect hits.

    3.3 Tiered Routing: Coordinating Large and Small Models

    The rapid growth of new models on the rankings supports a “tiered routing” strategy: assign intent recognition, format conversion, and summarization to lightweight models; assign complex reasoning and long-form generation to more capable models. The routing layer can use dual criteria of rules plus confidence:

    1. def route(task, confidence):
    2. if task.type in {"classify", "extract", "rewrite"} and confidence > 0.8:
    3. return "light_model"
    4. return "strong_model"

    This reduces cost and, during peak periods, reserves scarce large-model compute for requests that truly need it.

    4. Stability: Rate Limiting, Degradation, and Retries Done Right

    Under high concurrency, stability takes priority over single-request optimality.

    • Rate limiting must be layered: limit per tenant at the entry point, limit per model pool at the gateway, and limit per concurrency semaphore on the client. All three layers are required.
    • Degradation must be predictable: prefer returning cached results, smaller-model results, or templated fallbacks rather than returning errors directly.
    • Retries must be restrained: retry only idempotent failures that can be determined to have “produced no side effects,” using exponential backoff with jitter and a retry budget to avoid retry storms amplifying the failure.
    • Timeout budgets must propagate: the upstream remaining time should serve as the downstream timeout ceiling to prevent wasted computation.
    1. Retry budget example: at most 2 retries per request, global retry ratio not exceeding 10%
    2. Backoff sequence: 200ms → 800ms (with ±20% jitter)

    5. Observability: No Measurement, No Optimization

    It is recommended to collect at least the following dimensions and link them to business identifiers:

    1. Token dimension: input/output token volume, cache hit rate;
    2. Latency dimension: TTFT, TPOT, end-to-end P95/P99;
    3. Quality dimension: refusal rate, format compliance rate, manual sampling pass rate;
    4. Cost dimension: cost per token, cost per request, allocation by tenant.

    Logs, metrics, and traces should be correlated under the same request identifier, making it possible to drill down from “a tenant’s bill is abnormal” to “a certain class of long-input requests is causing queueing.” For monitoring and alerting, SLO burn rate is recommended as the primary signal rather than single-point thresholds.

    6. Cost Control: Break the Bill Down to an Optimizable Granularity

    The prerequisite for cost governance is attribution. Tagging by tenant, by business line, and by model tier makes it possible to identify abnormal growth. Common measures include input-side trimming and summarization preprocessing, output length caps, cache reuse, lightweight-model offloading, and off-peak execution of batch asynchronous tasks. It should be noted that any “downgrade” must be preceded by a quality regression evaluation, to avoid trading an invisible drop in accuracy for a visible drop in the bill.

    7. Rollout Path: Four Stages

    1. Baseline stage: fix an evaluation set, get the calling pipeline working end to end, and collect baselines for TTFT/TPOT/token volume;
    2. Optimization stage: introduce continuous batching, prefix caching, and tiered routing, A/B testing each item;
    3. Hardening stage: complete rate limiting, degradation, retry budgets, and SLO alerting;
    4. Operations stage: build a cost attribution dashboard and quarterly capacity reviews, reserving elastic headroom for ranking-style volatility.

    8. Conclusion

    The continuous refreshing of call-volume rankings essentially reflects that inference demand has become a normalized infrastructure load. For development teams, the real competitive edge lies not in chasing any single model, but in whether they possess model-calling engineering capabilities that are measurable, elastic, degradable, and attributable. If an enterprise wants to further reduce operational burden on this system, it can evaluate general cloud product categories such as the container platform, message queue, log service, and monitoring and alerting offered by Baidu AI Cloud, combining them as needed to build its own high-concurrency inference foundation.