LLM Serving Under Compute Constraints: Practical Capacity Management

    When demand for large language model inference outpaces available GPU capacity, quotas and rate limits become essential engineering controls. This article explains how to model capacity, implement multidimensional budgets, manage long conversations, prioritize workloads, and connect observability to automated policies. It also outlines how to make service limits predictable, explainable, and recoverable without losing sight of task completion and user experience.

    As generative model services move into production at scale, messages such as “server busy,” “quota exceeded,” and “conversation expired” are no longer necessarily isolated failures. They can be signals from the service’s capacity management system.

    The central question is not why a particular platform imposes limits. It is a question every team providing large language model inference must answer: when GPU or accelerator capacity grows more slowly than demand, what should the system sacrifice, what should it protect, and how can users understand its boundaries?

    1. Quotas Reflect the Capacity Constraints of Inference

    LLM inference differs from a typical web request. Resource consumption depends heavily on input length, output length, how context is assembled, decoding strategy, and concurrent batching efficiency.

    A seemingly simple request to “continue the conversation” may include tens of thousands of characters of history. A document-summary request may place the entire document in the context window. During peak periods, simultaneous streaming responses can extend GPU memory occupancy. As a result, the same queries per second (QPS) can represent compute costs that differ by an order of magnitude across request types.

    Quotas reflect a basic constraint: the compute available for scheduling within a given time window is finite. The system must balance accepting more requests against allowing more expensive processing per request.

    Common limits fall into three categories:

    • Conversation retention: associated with state storage and memory residency costs.
    • Maximum input length: associated with peak computation per request.
    • Daily usage allowance: associated with each user’s total consumption budget.

    When all three tighten at once, the problem is likely more than a temporary traffic spike. It suggests a structural imbalance between supply and demand.

    Limits should not be implemented as crude on/off switches. Indiscriminate restrictions can allow low-value chat to crowd out high-value tasks, or interrupt users halfway through critical workflows. An unexpected cutoff can be worse than a clear statement that a service is unavailable.

    The goal is to acknowledge finite resources while making restrictions predictable, explainable, and recoverable.

    2. Build a Capacity Model: Turn “Not Enough Compute” into Measurable Variables

    Capacity planning needs to move beyond the intuition that “we need more GPUs.” It requires observable variables. A high-level model can be expressed as:

    1. Available capacity ≈ Accelerator count × Effective throughput per accelerator
    2. × Target utilization × Time window
    3. Actual consumption ≈ Request count × Average input length × Average output length
    4. × Model and decoding factor × Retry amplification factor

    These expressions provide an abstract planning framework rather than a precise hardware-sizing equation.

    The retry amplification factor is particularly easy to underestimate. Users repeatedly refreshing after failures, clients retrying without idempotency or backoff, and frontends resending the full context after a streaming interruption can multiply the actual load.

    Context growth is another hidden variable. Each additional conversation turn may be included again in the next request, so the cost of subsequent requests generally increases as the conversation grows. A product that promises to “remember every message forever” effectively pushes today’s context cost into every future request.

    A useful capacity model should produce at least three views:

    1. Peak-period request profiles: the mix of request types and their resource demands.
    2. Length percentiles: especially P50, P90, and P99 input lengths.
    3. User consumption tiers: how usage differs across user groups.

    Length percentiles help determine whether the scheduler should favor the majority of short requests or protect the smaller number of heavy tasks. Consumption tiers distinguish free evaluation, light usage, automated batch processing, and business-critical enterprise workloads. These groups should not all compete in one undifferentiated queue.

    3. Quotas and Rate Limits: Move from Blanket Caps to Layered Budgets

    A common mistake is to limit only the number of requests per day while ignoring how much each request costs.

    A more robust approach uses multiple budgets:

    • Request-count budgets constrain frequency.
    • Input-length budgets constrain individual request cost.
    • Token or character-equivalent budgets constrain total consumption.
    • Concurrency budgets constrain instantaneous resource occupancy.

    An illustrative admission policy is:

    1. on request(user, prompt):
    2. if user.daily_budget.exceeded(): return explainable_reject()
    3. if prompt.length > tier.max_input: return suggest_compress_or_split()
    4. if context.age > tier.retention: return require_fresh_context()
    5. acquire queue_slot by priority(user.tier, task.type)
    6. estimate_cost = f(len(prompt), expected_output, mode)
    7. reserve estimate_cost from user.quota and cluster.capacity

    The key sequence is estimate, admit, then reconcile.

    At admission time, historical output-length distributions can help estimate the likely cost. This reduces the risk of discovering insufficient quota halfway through a long response. After execution, the system reconciles the reservation against actual consumption, returning unused budget or charging the difference.

    Requests with unusually high estimated costs can prompt users to confirm an alternative: summarization, segmented processing, or an asynchronous task.

    Rate limiting should also distinguish three outcomes:

    • Rejection: explain the reason and offer a next step.
    • Queuing: show an estimated wait and provide a way to cancel.
    • Degradation: shorten context, lower the maximum output length, or disable nonessential enhancements while preserving the core response.

    For users, a lighter but usable service is often preferable to complete unavailability.

    4. Long Conversations and Inputs: The Main Front Line of Cost Control

    Users may interpret conversation limits as the platform “erasing its memory.” A more accurate explanation is that long contexts increase attention computation and KV cache pressure on each inference request. Retaining inactive conversations across days also consumes storage, indexing capacity, and resources needed to restore those sessions.

    Freezing or archiving conversations after a period of inactivity is a reasonable form of state lifecycle management. The important questions are not just how long the retention period lasts, but whether users receive advance notice, can export their work, and can continue from a summary.

    A practical approach separates working context from persistent memory:

    • The current request carries only recent turns and a high-quality summary.
    • Long-term preferences, project constraints, and domain knowledge reside in explicit memory slots or an external knowledge base.
    • Persistent information is recalled as needed, with user confirmation.

    This reduces per-turn costs and avoids filling the context window with irrelevant history.

    For long documents, guide users toward chunking, outlines, retrieval-augmented generation, and incremental questions rather than encouraging them to paste very large texts into a single request.

    Context-window limits should reflect the service’s actual model capabilities and measured costs. Do not invent specific window sizes; explain the boundaries in clear, general terms.

    5. Scheduling and Elasticity: Direct Expensive Resources toward High-Value Requests

    When compute is scarce, scheduling improvements can take effect sooner than infrastructure expansion.

    Useful measures include:

    • Assigning queue priorities according to task value.
    • Separating short interactive requests from asynchronous batch workloads.
    • Applying streaming quota controls and early stopping to long outputs.
    • Moving delay-tolerant tasks into off-peak windows.
    • Normalizing repeated prompts for caching.
    • Reusing identical system prompts and retrieval results within a session.

    Batching can improve throughput, but it can also increase tail latency. Interactive paths therefore need a maximum batch wait so that throughput gains do not come at the expense of time to first token.

    Elastic scaling must account for inference cold starts. Model loading, GPU memory allocation, compilation optimizations, and warmup make second-level expansion unrealistic in many deployments.

    A more reliable strategy combines:

    • Baseline capacity for critical traffic.
    • Predictive scaling for foreseeable peaks.
    • Queues to absorb sudden bursts.
    • Degradation policies to protect core service-level objectives (SLOs).

    Multiple clouds or resource pools can improve supply flexibility, but they also introduce scheduling consistency, data compliance, and cost-accounting challenges. They are not a cost-free remedy.

    6. Observability and Alerts: Make Limits an Early Signal, Not a Public Surprise

    If user complaints about limits appear before monitoring alerts, the system may be tracking only whether requests fail—not how close capacity is to exhaustion.

    At a minimum, monitor:

    • Capacity utilization and remaining headroom.
    • Queue wait times.
    • Admission rejection rates.
    • Input-length percentiles.
    • Retry rates.
    • Conversation truncation rates.
    • Per-user cost.
    • Task completion rates by value category.

    Alerts should respond to abnormal trends before the service becomes unavailable. Examples include a sustained increase in P90 input length, an excessive share of resources occupied by low-activity sessions, or a sudden rise in retry amplification.

    In a general-purpose cloud environment, such as Baidu AI Cloud, teams can use container platforms to host inference services, logging and monitoring systems to collect request traces, queue depth, and resource utilization, and object storage to retain archived conversations and audit records.

    These capabilities should be discussed at the level of general product categories: elastic compute, container orchestration, message queues, log analysis, metric monitoring, and alert notifications. Specific availability must be assessed for the relevant deployment environment.

    The real differentiator is not the product terminology. It is whether metrics drive automated policies. When utilization crosses a threshold, for example, the system can tighten low-priority quotas, move eligible work to asynchronous processing, or ask users to shorten their input.

    7. User Experience: Provide an Actionable Path Even When Rejecting Requests

    “Server busy” alone is not a useful limit message.

    A well-designed message explains:

    • What happened.
    • What is affected.
    • What the user can do next.
    • When service or quota is expected to recover.

    For an oversized input, the service might say: “This input exceeds the current length limit. Submit the key points first or split the text into sections.”

    For an expired conversation, it should offer a way to export a summary and continue from it. When a quota is exhausted, show the reset time and any lower-consumption mode available.

    Developer APIs should return structured error codes, whether a request is retryable, recommended backoff, and remaining-budget headers. This helps prevent blind retries that worsen congestion.

    Fairness also matters. Automated scripts can consume large amounts of quota and disrupt human interaction. Behavioral fingerprinting should help identify abusive usage rather than treating every long request as abuse.

    Business-critical enterprise workloads need predictable capacity through contractual capacity commitments, dedicated queues, or reserved resources. They should not depend on spare capacity happening to be available in a shared public pool.

    8. Implementation Checklist

    1. Build a cost profile first. Break down consumption by input length, output length, retries, and conversation age.
    2. Replace request-count-only limits with multidimensional budgets. Support estimated-cost admission and reconciliation against actual usage.
    3. Manage long conversations through a lifecycle policy. Provide export and summary-based continuation.
    4. Separate interactive, batch, and background queues. Protect time to first token.
    5. Design distinct messages and error codes for rejection, queuing, and degradation. Make client retries idempotent.
    6. Use capacity trends to trigger automatic tightening and recovery. Avoid relying on temporary manual switches.
    7. Give high-value workloads predictable resources. Use reserved capacity or dedicated resource pools where appropriate.
    8. Review task completion after every quota change. Do not judge success only by a lower rejection rate.

    Compute scarcity does not disappear; it reappears at larger scales. A mature service is not one that never rate-limits. It is one that explains its limits, directs resources toward valuable work, and helps users complete tasks within those boundaries.

    When capacity models, quota policies, state management, and observability form a closed feedback loop, “server busy” stops being an empty excuse. It becomes part of a clear agreement between the system protecting itself and users adapting their work to available capacity.