Why LLM APIs Keep Returning "Server Busy": Causes and Fixes

    This article explains why large language model APIs frequently return "server busy" messages, which are usually a sign of admission control under overload rather than an outage. It breaks down the root causes across four layers—traffic, GPU memory (KV cache), scheduling, and platform policies—and lists six client-side mitigations such as off-peak calls, exponential backoff with jitter, streaming output, context trimming, result caching, and request batching. It also covers server-side capacity and stability practices, ending with how the same capabilities can be built on Baidu AI Cloud.

    1. What the Message Really Means: Overload Protection, Not a Failure

    Many developers run into the same prompt when calling a large language model API. The first instinct is often that the server is down or the network is broken. From a system design perspective, however, this message is usually the normal output of admission control: when the instantaneous arrival rate exceeds what the system can currently handle, the server deliberately rejects part of the requests to preserve the completion quality and tail latency of the requests it has already accepted.

    This is semantically the same as the 503/429 responses of traditional web services, just wrapped in friendlier wording. This distinction matters: the goal is not to “fix” the message, but to make the client adapt to the system’s load characteristics.

    2. Root Causes: Four Layers of Resource Bottlenecks

    2.1 Traffic: Bursts and Queuing Theory

    Arrival patterns for online inference services often show clear long-tail and pulse behavior (on the hour, during campaigns, right after a model version update). When the arrival rate λ approaches the service rate μ, queue length grows nonlinearly and waiting time tends to diverge. This is the mathematical root of “the busier it gets, the slower it becomes; the slower it becomes, the busier it gets.”

    2.2 GPU Memory: KV Cache Is the Real Bottleneck

    Many people assume compute (FLOPs) is the bottleneck. In the autoregressive decoding stage, memory capacity and memory bandwidth are usually exhausted first. Every request must maintain a key-value cache for all historical tokens, and its footprint is roughly:

    1. KV_bytes ≈ 2 × layers × kv_heads × head_dim × seq_len × batch × dtype_bytes

    The longer the context and the higher the concurrency, the more memory usage grows linearly, leaving the system with no choice but to reduce concurrency or truncate context.

    2.3 Scheduling: The Batch Processing Dilemma

    Higher throughput depends on packing multiple requests into continuous batches (continuous batching), but the longest sequence in a batch dictates the pace of the whole batch, so short requests get held back by long ones. There is also an inherent trade-off between time to first token (TTFT) and time per output token (TPOT): the larger the batch, the higher the throughput, and the worse the experience for each individual request.

    2.4 Policies: Rate Limiting, Degradation, and Isolation

    Mature platforms apply tenant-level quotas, priority queues, separate pools for long and short requests, and fallback to smaller model variants. When these policies kick in, all the client sees is a uniform “busy” message.

    3. Client Side: Six Mitigations You Can Apply Right Away

    1. Call off-peak: Move batch and offline tasks (data cleaning, summary archiving, bulk labeling) out of peak windows, and use a message queue to smooth out spikes.
    2. Exponential backoff with jitter: Avoid retry storms that cause secondary overload.
    1. import random, time
    2. def call_with_backoff(fn, max_retry=5):
    3. for i in range(max_retry):
    4. try:
    5. return fn()
    6. except Exception as e:
    7. if i == max_retry - 1:
    8. raise
    9. sleep = min(2 ** i, 8) + random.uniform(0, 0.5)
    10. time.sleep(sleep)
    1. Streaming output: Receive incremental results over SSE and render as soon as the first token arrives. Perceived latency drops sharply, and anomalies surface earlier.
    2. Trim the context: Keep only the history you need, retrieve relevant passages from long documents before assembling the prompt. Compressing the prompt is the cheapest performance optimization available.
    3. Cache and reuse results: For deterministic tasks, add a cache layer that maps a semantic fingerprint to a result. A higher hit rate directly cuts call volume.
    4. Batch requests and control budgets: Merge documents in the same batch into a single call; set a token budget cap per session to keep long-tail requests from occupying resources indefinitely.

    4. Server Side: Building Capacity and Stability

    • Capacity planning: Work backward from peak QPS, average/P95 context length, and target TTFT to derive the required number of instances, and leave headroom for bursts.
    • Elastic scaling: Scale out on leading indicators such as queue length and GPU memory utilization rather than CPU alone; a container platform plus auto-scaling policies can shorten scaling latency.
    • Observability: Use a log service and monitoring alerts to connect four curves—call volume, failure rate, queue time, and token throughput—with tiered alerting.
    • Asynchronous architecture: For non-real-time scenarios, switch to “submit a task + callback/polling,” decouple with a message queue, and turn synchronous waiting into asynchronous delivery.
    • Multi-variant fallback: During peaks, route less sensitive traffic to smaller parameter variants or shorter-context configurations to protect the core path.

    5. Building This on Baidu AI Cloud

    You can run inference services on a container platform with auto-scaling configured, use a message queue for peak shaving and asynchronous decoupling, use object storage to retain corpora and result caches, and add a log service plus monitoring alerts to close the loop. The key is to productize the four things—capacity, scheduling, degradation, and observability—instead of relying on manual restarts to stay available.

    6. Conclusion

    “Server busy” is an overloaded system honestly reporting its own state. Clients trade backoff, streaming, caching, and off-peak calls for success rate; servers trade elasticity, isolation, and observability for stability. Only when both sides work together can occasional prompts be pushed down to an acceptable level.