LLM Compute Bottlenecks and Capacity Planning: A Practical Guide

    This article breaks down why generative LLM inference is harder to scale than traditional web services, and how to plan capacity around it. It covers GPU memory as a hard constraint, unpredictable output lengths, the throughput-versus-latency tradeoff, a layered approach to locating bottlenecks across compute, storage, and scheduling, and practical capacity planning using baselines, pressure coefficients, and elastic scaling. It also outlines overload handling, observability metrics, and unit-cost-per-token optimization for teams running or buying generative inference.

    LLM Compute Bottlenecks and Capacity Planning: A Practical Guide

    1. The Symptom: From “Service Outage” to “Capacity Mismatch”

    A common type of incident discussed in the community lately: a large-model online service slows down, queues requests, or becomes briefly unavailable during peak business hours. The original discussion was full of emotional reactions, blaming a hardware vendor’s production shortfall, a slow data center buildout, or a coding assistant tool being “too good.” All of these point at the same underlying fact, yet none of them reach the engineering essence.

    Strip away the specific brands and products, and this kind of event abstracts into a general problem: the growth rate of token processing demand per unit time has outpaced the growth rate of the compute and scheduling capacity the system can deliver. This is not a one-off failure at a single vendor. It is a structural challenge that every platform offering generative inference runs into during periods of rapid business growth.

    Break it into three measurable dimensions, and the discussion shifts from “whose fault is it” to “what breaks first”:

    • Demand side: requests per second (QPS) × average input length × average output length, giving token throughput demand (tokens/s).
    • Supply side: number of accelerators × effective throughput per card × utilization ceiling, giving the token throughput ceiling.
    • Match: demand / supply = pressure coefficient. When the pressure coefficient stays above 1 for a long time, queueing latency rises non-linearly and eventually shows up as timeouts and unavailability.

    The observation in the original discussion that “usage jumped several times in a short period” corresponds, in engineering terms, to a scenario where the pressure coefficient climbs from 0.6 to 2.4 within a few weeks. At that point the system is not “broken.” Rather, its designed capacity has been left behind by business growth.

    2. Why Generative Inference Is Harder to Scale Than Traditional Services

    Scaling traditional web services is relatively linear: add machines, add thread pools, and throughput rises roughly in proportion. Generative inference has three characteristics that make this experience impossible to copy directly.

    2.1 GPU memory is a hard constraint, not a compressible resource

    The inference stage must hold both the model weights and the key-value cache (KV Cache) at the same time. The size of the KV cache is proportional to “concurrent requests × context length,” which means the longer the context, the fewer requests that can be processed simultaneously. When users commonly feed in long documents or large codebases, the same number of cards supports a significantly lower concurrency. This is the item most teams miss when doing capacity planning.

    2.2 Unpredictable output length makes load uncontrollable

    Input length is known when a request arrives, but output length is determined by the model’s generation process. One request may finish after generating 50 tokens; another may keep generating for thousands. If the scheduler load-balances by “request count” rather than “expected token count,” a few long-output requests will occupy batch slots for a long time and slow down all the requests sharing the batch, the classic head-of-line blocking.

    2.3 Batching is efficient but latency-sensitive

    To raise throughput, inference frameworks merge multiple requests into a single batch for parallel computation. The larger the batch, the lower the cost per token, but the longer the wait to fill the batch and the higher the time to first token (TTFT). Throughput and latency are directly opposed here. There is no configuration that is optimal for both; you can only make tradeoffs according to the business SLA.

    3. Locating the Bottleneck: A Layered Investigation of Three Cause Categories

    When a service slows down, do a layered diagnosis first to avoid misjudgment. Investigate in the order below, because the earlier layers are both easier to verify and more common.

    3.1 Compute supply layer

    Metrics to watch: accelerator utilization, GPU memory usage, number of queued requests, actual batch size.

    If utilization stays close to the ceiling for a long time and the queue keeps growing, it is genuine capacity shortage. The right response is to scale out or reduce the resource consumption per request (for example, shortening context or enabling cache reuse), not to restart the service repeatedly.

    3.2 Storage and data layer

    Metrics to watch: object storage read latency, model weight loading time, cache hit rate.

    An often-overlooked detail: model weights can be tens to hundreds of gigabytes, and if every scale-out has to re-pull them from remote object storage, the scaling speed is locked by network bandwidth. Weight pre-warming and local caching are the key to compressing scale-out time from tens of minutes down to a few minutes.

    3.3 Scheduling and policy layer

    Metrics to watch: rate-limit trigger count, timeout rate, retry rate, distribution of queue wait time.

    Problems at this layer are the most hidden: capacity is actually sufficient, but the policy is blocking requests. A typical symptom is a retry storm, where the client retries immediately after a timeout, the retried requests fill up the queue again, and a positive feedback loop forms. A token-bucket rate limiter like the one below can suppress this kind of avalanche:

    1. import time
    2. class TokenBucket:
    3. """Rate-limit by token budget, not by request count"""
    4. def __init__(self, capacity: int, refill_per_sec: float):
    5. self.capacity = capacity
    6. self.tokens = capacity
    7. self.refill = refill_per_sec
    8. self.last = time.monotonic()
    9. def acquire(self, need: int) -> bool:
    10. now = time.monotonic()
    11. self.tokens = min(self.capacity,
    12. self.tokens + (now - self.last) * self.refill)
    13. self.last = now
    14. if self.tokens >= need:
    15. self.tokens -= need
    16. return True
    17. return False

    Note that the deduction unit here is the “estimated token count,” not a simple “1 request.” This is the core difference between rate limiting for generative services and rate limiting for traditional APIs.

    4. Capacity Planning: Turning Growth into a Computable Curve

    4.1 Establish a baseline

    First measure the effective throughput (tokens/s) of a single card under the current model and current context distribution, and be explicit about the latency constraint under which it was measured. Talking about throughput detached from a latency constraint is meaningless. Measure at least three tiers: short context, medium context, and long context.

    4.2 Set the pressure coefficient and watermark

    In engineering, the steady-state watermark is usually kept at 60%–70% of peak, leaving headroom for burst traffic. If the month-over-month growth rate is r, then demand after N months is demand₀ × (1+r)^N. The “several times growth in one month” mentioned in the original discussion, if sustained, becomes more than four times after two months. Under exponential growth, procuring hardware on a linear schedule will inevitably lag.

    4.3 Trade elasticity for certainty

    The scale-out cycle of a self-built compute pool is measured in weeks or months and cannot match hourly traffic fluctuations. A workable general approach is to tier the load:

    • Put baseline traffic on a resident resource pool, pursuing low cost and high stability;
    • Let peak traffic spill over into an elastic resource pool that scales on a second-by-second basis;
    • Schedule offline batch jobs (such as batch summarization and batch labeling) to run during idle time, filling valleys rather than peaks.

    Combined with horizontal scaling on a container platform and a message queue for request buffering, you can convert an instantaneous flood into a smooth consumption rate:

    1. # Example: scaling policy based on queue backlog
    2. scaling:
    3. metric: queue_backlog_per_replica
    4. target: 20 # pending requests per replica
    5. minReplicas: 4
    6. maxReplicas: 60
    7. scaleUpCooldown: 30s
    8. scaleDownCooldown: 300s # scale down slowly to avoid flapping

    Setting the scale-down cooldown longer than the scale-up cooldown is an easily overlooked but very effective rule of thumb: scale up fast, scale down steadily.

    5. Stability Design: Making Overload a Controlled Degradation

    Capacity planning answers “is it enough.” Stability design answers “what to do when it is not enough.” The core principle is shed part of the load proactively when overloaded, rather than letting all requests slow down together.

    Priority queues: split requests into interactive and batch classes. Interactive requests get short timeouts and high priority; batch requests get long timeouts and low priority. When overloaded, pause batch processing first to preserve the interactive experience users can perceive.

    Context budget control: set an upper limit on input length, and route over-limit inputs to asynchronous tasks that return results, avoiding a single request occupying GPU memory for a long time.

    Result caching and semantic reuse: reuse existing generation results for high-frequency similar requests. In scenarios like coding assistance and document Q&A, the repetition rate is often high, and a cache hit can directly cut a substantial share of compute consumption.

    Graceful degradation: when the primary model is unavailable, switch to a smaller-parameter model or a templated response, and clearly mark the degraded state in the response instead of returning an error outright.

    Client-side conventions: the server should return a suggested retry time in the response, and the client should use exponential backoff with jitter to avoid a second impact from synchronized retries:

    1. import random, time
    2. def call_with_backoff(fn, max_attempts=5):
    3. for i in range(max_attempts):
    4. try:
    5. return fn()
    6. except TransientError:
    7. if i == max_attempts - 1:
    8. raise
    9. delay = min(2 ** i, 30) + random.uniform(0, 1)
    10. time.sleep(delay)

    6. Observability: No Measurement, No Capacity

    Capacity discussions must be built on data. Collect at least the following four categories of metrics and configure corresponding alerts:

    • Throughput: input/output token rates, request success rate;
    • Latency: first-token latency and end-to-end latency percentiles (P50/P95/P99); looking only at the mean hides the long tail;
    • Resources: accelerator utilization, GPU memory usage, average batch size;
    • Business: share of token consumption broken down by call source and scenario, used to identify the source of abnormal growth.

    Feed logs and metrics into a unified logging service and monitoring/alerting system, and build dashboards and threshold alerts. A practical approach is to set “growth-rate alerts” rather than only “absolute-value alerts”: when week-over-week token consumption exceeds a preset threshold, issue an early warning and move the scaling decision from reactive firefighting to proactive planning.

    7. The Cost Perspective: Unit Cost per Token Is the Real Metric

    The original discussion noted that costs vary enormously across different calling methods. This is entirely valid in engineering terms and more worth attention than an “outage.” To evaluate an inference service, look at the total cost per million tokens, which is made up of four parts: compute amortization, storage and network, the loss from cache hit rate, and the extra consumption from failed retries.

    The optimization path, ordered by cost-effectiveness, is usually: raise the cache hit rate → compress useless context → set a reasonable maximum output length → tiered model routing (simple requests go to small models) → and only then buy more compute. Optimize utilization first, then scale out. That is the basic order for controlling cost.

    8. Conclusion

    A brief service outage is, in essence, the demand curve running ahead of the capacity curve. Rather than arguing about who is responsible, treat it as a trigger for a capacity review: quantify the token throughput baseline, pin down whether the bottleneck is in supply, data, or scheduling, use layered rate limiting and priority queues to protect the interactive experience, use elastic scaling and queue buffering to absorb peaks, use percentile latency and growth-rate alerts to surface risk early, and use unit cost per token to constrain long-term investment.

    This approach does not depend on any specific vendor or product and applies to every team that builds or buys generative inference capability. The real mark of maturity is not never having failures, but failures that are predictable, impacts that are isolated, and recovery that is measurable.