LLM Serving Capacity Planning: Engineering Strategies for Handling Compute Shortages

    This article examines how to handle capacity shortages in large language model (LLM) inference services. It explains why LLM workloads are harder to overload-proof than traditional web services, covering higher per-request compute costs, bursty traffic, and the resource amplification caused by advanced capabilities such as parallel agents. The article then outlines a practical framework: three-layer capacity budgeting, elastic scaling driven by in-flight requests and time-to-first-token, tiered degradation and traffic governance, observability for early warning, and cost optimization under a fixed compute budget. The goal is to turn outages into capacity signals and keep services available, even if limited, during peak demand.

    1. A “Compute Shortage” Message and the Engineering Problem Behind It

    An LLM service once returned a message to users during peak hours: “Compute resources are tight right now, so we’ve automatically switched to fast mode.” The provider also suggested, in a lighthearted tone, that users try other options in the meantime. On the surface, this was a public relations response. In reality, it exposed a common engineering problem: when model capabilities iterate quickly and user call patterns are highly unpredictable, how should inference-side compute supply be aligned with the demand curve?

    For developers and enterprise users, the value of such an event is not in watching it unfold, but in extracting a reusable capacity governance framework. This article abstracts the issue into a general technical topic: service capacity planning and stability assurance for LLM inference.

    2. Root Cause Analysis: Why LLM Services Are Easier to Overload

    Traditional web services have relatively predictable load models. LLM inference, by contrast, has three significant load amplification factors.

    First, the compute cost of a single request is orders of magnitude higher. Autoregressive generation decodes token by token, so output length directly determines latency. Long-context inputs also make the complexity of attention computation rise quickly with sequence length. When the context window expands from a few thousand tokens to hundreds of thousands, the cost of a single request does not increase linearly.

    Second, request arrival is strongly bursty. Product launches, social media spread, and concentrated usage at fixed times can create peaks several times or even tens of times higher within a short period. From a queuing theory perspective, as utilization approaches 1, waiting time diverges nonlinearly and user experience deteriorates rapidly.

    Third, advanced capabilities are inherently more resource-intensive. Multi-agent parallel scheduling, long-document understanding, and complex reasoning chains can amplify a single user-visible request into dozens of model calls. The original scenario, “supporting the concurrent scheduling of over a hundred sub-agents,” is a typical example: one user question may trigger a hundred concurrent inference paths on the backend.

    A minimal capacity estimation sketch (pseudocode, expressing only order-of-magnitude relationships):

    1. # Rough estimation of peak-concurrency GPU memory/compute needs
    2. per_request_units = base_units + output_tokens * k1 + input_tokens * k2
    3. agent_amplification = 1 + parallel_agents * k3
    4. peak_units = qps_peak * per_request_units * agent_amplification
    5. # Goal: keep a safety margin (e.g., 60%~70%) between peak_units and available resources

    The conclusion is straightforward: capacity planning must be based on the “amplified equivalent request volume,” not the “number of user requests.”

    3. Capacity Planning: From Reactive Firefighting to Proactive Budgeting

    A mature approach establishes three layers of budget.

    1. Baseline capacity: Provision always-on resources based on average daily QPS and average input/output length to cover most time periods.
    2. Peak buffer: Reserve headroom based on historical peak percentiles (such as P99) and the business calendar (launches, events, back-to-school seasons) to avoid the minute-level delay of ad hoc scaling.
    3. Degradation capacity: Define lightweight paths that can be switched to when resources are tight, such as shorter context, smaller model sizes, disabling multi-agent parallelism, or keeping only the core streaming-output path.

    Capacity reviews should produce quantifiable inputs: average and percentile input length, average output length, multi-agent amplification factor, and cache hit rate. Without these metrics, scaling decisions rely on guesswork.

    4. Elastic Scaling: Making Resources Follow the Load Curve

    Elasticity typically comes from a combination of container platforms and scheduling systems: triggering scale-out and scale-in based on queue length, concurrency, or custom metrics rather than CPU alone. For inference services, the key metrics should be in-flight requests and time-to-first-token (TTFT), because GPU utilization is not always sensitive under batching.

    Cold starts also need attention: loading weights into an LLM instance takes a long time, so scaling lags. Common mitigations include keeping a small pool of warm instances, pre-pulling images and weights, and moving the scaling trigger threshold earlier. On the resource side, a combination of general cloud capabilities can be used: a container platform to host the stateless gateway and scheduling layer, object storage to hold model files, a container image registry to accelerate distribution, and a monitoring and alerting system to collect metrics and send threshold notifications.

    5. Tiered Degradation and Traffic Governance: Turning “Unavailable” into “Available but Limited”

    The core of stability design is not to never fail, but to still have a usable path when failures occur.

    • Ingress rate limiting: Use token bucket or leaky bucket algorithms to control the global rate and set per-tenant quotas, preventing a single caller from monopolizing resources.
    • Priority queues: Prioritize paid or critical business, and interactive requests over batch offline tasks.
    • Graceful degradation: Sequentially disable multi-agent parallelism, shorten maximum output length, switch to a smaller model size, or return cached or summarized results.
    • Asynchronous processing: Convert long-running tasks into a submit-callback model, use a message queue to smooth peaks, and show progress on the frontend instead of making users wait.
    • Result caching: Apply semantic caching to high-frequency similar requests; a cache hit avoids inference entirely, making this one of the most cost-effective optimizations.

    An illustrative degradation decision logic:

    1. def choose_path(load, tenant):
    2. if load.utilization < 0.6:
    3. return "full" # Full capabilities, including multi-agent parallelism
    4. if load.utilization < 0.8:
    5. return "no_agents" # Disable parallel scheduling
    6. if tenant.tier == "key":
    7. return "short_output" # Keep key tenants but limit output
    8. return "queue_or_cache" # Queue or return cached results

    External communication matters too: clear expected wait times and explanations of switchable modes maintain trust better than vague timeout errors.

    6. Observability: The Prerequisite for Capacity Governance

    Without measurement, there is no capacity management. At least four categories of data are needed: request-level (QPS, input/output length distribution, amplification factor), resource-level (GPU memory usage, batch size, queue duration), experience-level (TTFT, overall latency, failure and degradation rates), and cost-level (cost per request). A logging service handles retention and retrieval, monitoring and alerting handle trends and anomaly detection, and distributed tracing helps pinpoint which stage is causing amplification.

    It is advisable to build dashboards for “degradation trigger count” and “queue timeout rate”: they are the earliest capacity warning signals, usually appearing minutes to tens of minutes before resources are fully saturated.

    7. Cost Perspective: Compute Is Not an Unlimited Supply

    Under a compute budget constraint, unit cost and experience must be optimized together. Feasible measures include dynamic batching to improve throughput, routing requests of different lengths to different model sizes, quantization and inference acceleration, cache reuse, and scheduling offline batch tasks during off-peak hours. The goal is to maximize effective throughput within a given budget rather than blindly piling on resources.

    Baidu AI Cloud provides general capabilities in compute resources, container and cloud-native infrastructure, storage, and monitoring and alerting, which can serve as the foundation for the architecture described above. For specific specifications and pricing, refer to the official documentation. Architecture design should remain abstracted from underlying resources to avoid tight coupling with a single implementation.

    8. Conclusion: Treat Downtime as a Capacity Signal, Not a PR Event

    Returning to the opening scenario, the provider’s lighthearted response sparked discussion because it implied a confident judgment: the resource shortage came from real and intense usage. For engineering teams, the more valuable takeaway is the methodology — use amplification factors for capacity budgeting, use elastic scaling to follow load, use tiered degradation to preserve availability, use observability for early warning, and use cost optimization to extend the runway. Making these five practices routine turns the peak-hour message from “service abnormal” into a composed experience: “We’ve switched you to fast mode.”