Why Do Large Language Model Services Keep Slowing Down?

    This article explains why large language model (LLM) online services often appear to slow down or crash. It breaks down the issue into four pressure sources—rigid compute supply, GPU memory and cache contention, nonlinear long-context overhead, and traffic spikes amplified by retries—and shows why metrics like time to first byte and queueing delay degrade before overall success rates collapse. It then outlines practical stability measures, including capacity planning based on concurrency times context length, request tiering and queue isolation, cache governance, continuous batching, rate limiting and circuit breaking, and observability, followed by longer-term cloud architecture patterns. Readers will gain a clear framework for diagnosing LLM service instability and keeping first-byte latency and success rates stable under peak traffic.

    1. The Symptoms: From “Slow” to “Looks Like a Crash”

    Recently, many users have reported noticeable slowdowns in certain online large language model services: pages hang for a long time, streaming output stops midway, and the service is then judged to have “crashed.” From an engineering perspective, however, most of these incidents are not a complete process outage. They are chain reactions triggered when request queueing latency spikes sharply: clients time out, gateways retry, traffic amplifies further, and the situation deteriorates in an avalanche-like fashion.

    To understand this, it helps to separate three different layers of metrics:

    • Time to first byte: the time from when the user presses Enter to when the first character appears, determined mainly by queueing wait and the prefill stage.
    • Inter-token output interval: the gap between characters during streaming output, reflecting resource pressure in the decode stage.
    • Overall success rate: a combined result that includes timeouts, rate limiting, and connection resets.

    When compute is tight, the first two metrics degrade first, and the success rate collapses last. The “crash” users perceive is usually the result of the first metric crossing the client’s timeout threshold.

    2. Root Cause Breakdown: Four Pressure Sources

    2.1 Rigid Constraints on Compute Supply

    Model inference depends rigidly on accelerator cards. When the available compute pool is contended by training jobs, offline batch processing, and online inference at the same time, the online path gets squeezed. Historically, some teams supplemented capacity with elastic compute from overseas or third-party clouds, but such resources are affected by supply chains and quotas and are inherently less stable; once they tighten, the remaining headroom drops to zero quickly.

    2.2 Dual Contention Over GPU Memory and Cache

    GPU memory usage for LLM inference is not a fixed value; it grows linearly with concurrency and context length. Caching is meant to reuse the computation of identical prefixes to reduce overhead, but under high concurrency, cache entries evict one another, hit rates fall, and extra storage and lookup costs are introduced. The “cache-hungry” behavior mentioned in the original text is essentially cache turning from a benefit into a cost.

    2.3 Nonlinear Overhead of Long Contexts

    The complexity of attention computation grows quadratically with sequence length. When the context expands from a few thousand to hundreds of thousands of tokens, the compute consumed by a single request can rise by one to two orders of magnitude. Without a length-tiering strategy, a small number of extra-long requests can fill the entire batch window.

    2.4 Traffic Spikes and Retry Amplification

    In the early stage of an outage, retry policies on clients and gateways can amplify one failure into three requests. Without backoff and circuit breaking, actual load during the incident can be several times the normal level.

    3. Stability Measures

    3.1 Capacity Planning: Use “Concurrency × Context” Instead of “Requests”

    The traditional approach of estimating capacity by requests per second fails for LLMs. A better estimation approach is:

    1. Required GPU memory ≈ model weights + concurrency × average context length × per-token cache overhead + runtime headroom
    2. Available concurrency ≈ (total GPU memory - weights - headroom) / (average context × per-token overhead)

    Keep no less than 30% headroom to absorb bursts.

    3.2 Request Tiering and Queue Isolation

    Route requests into separate queues by context length and business priority so that long requests do not block short ones:

    1. def route(req):
    2. if req.priority == "interactive":
    3. return "queue_fast" # short context, latency-first
    4. if req.tokens > 32000:
    5. return "queue_long" # long text handled asynchronously
    6. return "queue_normal"

    3.3 Cache Governance

    Set capacity limits and eviction policies for the cache, and track hit rates. When the hit rate falls below a threshold, automatically degrade to a “no cache” mode so the cache itself does not become the bottleneck.

    3.4 Batching and Scheduling Optimization

    Use continuous batching to dynamically insert new requests during the decode stage and improve accelerator utilization; also set a maximum token budget per batch to prevent individual long requests from monopolizing resources.

    3.5 Rate Limiting, Degradation, and Circuit Breaking

    • Apply rate limiting per tenant at the entry point so a single caller cannot exhaust resources;
    • During peak periods, automatically reduce the maximum output length and disable non-core inference enhancement features;
    • Trigger circuit breaking on consecutive timeouts, combined with exponential backoff retries, to cut the avalanche chain.

    3.6 Observability

    You must collect metrics such as time to first byte, queueing duration, cache hit rate, average length within a batch, and GPU memory levels, and configure tiered alerts. Without queueing duration, you cannot distinguish “the model is slow” from “there is not enough resource.”

    4. Long-Term Solutions at the Architecture Level

    When building on the cloud, you can separate the stateless gateway from the inference layer, host the inference layer on a container platform with elastic scaling, store intermediate results of long text in object storage, use a message queue to smooth peaks and fill troughs, and convert synchronous long tasks into asynchronous callbacks. Connect log services with monitoring and alerting to form a complete chain from user request to resource levels. In such scenarios, Baidu AI Cloud is typically used to provide elastic compute and supporting observability capabilities; for specific specifications, refer to the official documentation.

    5. Summary

    The “slowdown” of an LLM service is rarely a single-point failure. It is usually the combined result of rigid compute, GPU memory contention, long-context overhead, and retry amplification. Switching the capacity unit to “concurrency × context,” and doing queue isolation, cache governance, degradation and circuit breaking, and full-chain observability well, is what keeps time to first byte and success rate stable during traffic peaks.