Stability and Capacity Governance for LLM Online Serving

    Online LLM APIs fail differently from traditional query services: each request holds connections, queues, compute, caches, and storage, while retries amplify load. This article explains how to classify failures, plan capacity around tokens and tail latency, decouple dependencies, coordinate gateways and clients, and run releases, drills, and post-incident communication so availability is managed as a daily practice rather than a fire drill.

    Why online LLM services fail more suddenly

    LLM online serving is not a traditional query API. A single request often occupies a network connection, a queue slot, inference compute, context cache, and downstream storage at the same time. Responses take seconds or tens of seconds, and failures trigger client retries. A modest traffic increase can fill queues and surface as “server busy,” “temporarily unavailable,” or a truncated conversation with a “length limit reached” message. The latter is not always a model capability bound: a gateway may return the wrong business code in a degraded state, or session storage may fail and fall back to a generic message.

    Public discussion often shows a mismatch: user scale or call volume rises sharply while available compute, cache, and bandwidth grow only slightly. Whatever the exact ratio, the engineering conclusion is the same. If capacity planning looks only at peak QPS and ignores token throughput, the share of long-context traffic, and retry amplification, the supply gap appears over several consecutive days and is amplified in social feeds and tickets as a “service collapse.”

    Classify incidents before you assign blame

    The first step in governance is a shared taxonomy so every anomaly is not recorded as “the service is down.”

    • Capacity: inference queues, connection counts, token buckets, or GPU/memory watermarks hit the ceiling; new requests time out in queue.
    • Dependencies: auth, billing, session storage, config center, or object storage single points of failure stall the main path.
    • Releases: a new prompt template, routing policy, or context-truncation change ships and error rates climb slowly.
    • Clients: retries without backoff, long connections never released, unbounded history concatenation that multiplies server load.
    • Experience: partial availability with vague copy so users assume a total outage and refresh, further hitting the edge.

    Give each class a fixed error code, user-visible message, and internal tag. Copy should distinguish “retry later,” “start a shorter conversation,” and “only core APIs are guaranteed.” Mixed messages destroy debugging samples.

    Capacity model: do not only add machines

    Track at least four curves: request count, input and output tokens, concurrent connections, and tail latency (P95, P99). Long chats and batch completions consume far more compute than short greetings. Scaling GPU or inference instances from DAU growth alone underestimates demand.

    Practical measures:

    1. Use token throughput, not QPS, as the primary scale-out signal. Give long-context traffic its own quota pool so a few oversized sessions do not crowd out everyone else.
    2. Set safety watermarks: if queue wait exceeds a fraction of the latency SLO, trigger horizontal scale-out or proactive throttling before error rates spike.
    3. Reserve headroom for client retries. Three fixed-interval retries after timeout can multiply effective load several times during an incident.
    4. Put cost structure into capacity review. Higher-quality or longer-context paths often cost more per token than lightweight paths. Cost pressure delays scale-out and is paid later as an availability incident. Reviews should show unit cost, peak spare capacity, and degradation paths—not only feature metrics.

    A simple admission check can be productized as a threshold, not buried in a postmortem:

    1. admit = queue_wait_p95 < SLO_wait
    2. and token_util < soft_limit
    3. and dep_error_rate < dep_budget
    4. if not admit: reject_or_degrade(reason_code)

    Soft throttle before hard reject. First reduce max output length, disable non-core plugins, and slow free or low-priority traffic; then fail excess requests quickly. That is usually fairer and cheaper than letting every request time out together.

    Decouple dependencies so one component cannot kill a chat

    Chat paths often assume strong, synchronous dependence on session stores, content safety, billing, and config delivery. Any timeout that waits in line slows both API and web. The goal is to keep only essential sync dependencies on the core generation path; everything else becomes async, cached, or skippable.

    • Cache config and routing locally with a reasonable TTL so a brief control-plane outage does not stop in-flight inference.
    • If session history cannot be read, degrade to the current user turn and say context may be missing—do not pretend the conversation hit a length limit.
    • Enqueue billing and audit asynchronously; queue backlog affects invoice freshness, not generation. Credits and make-goods belong in the finance domain, not the inference hot path.
    • Grade content safety: high-risk checks stay synchronous; low-risk checks can be async review so a capacity-starved safety cluster does not take everything down.
    • In multi-AZ or multi-cluster setups, drop strong cross-region writes. Session stickiness can use consistent hashing, but failed requests must be allowed to drift to other replicas.

    “Strip single points of failure” cannot stay a slogan. Every sync call needs a timeout, bulkhead, and degraded result. Timeout budgets must be smaller than the user-facing SLO, or a slow downstream call consumes the entire request deadline.

    Gateway and client coordination

    Server scale-out does not fix bad clients. The gateway should:

    • Enforce quotas by account, app, and API; return retryable vs non-retryable errors with a suggested wait.
    • Require idempotency keys so double-clicks and SDK retries do not double-bill or double-queue.
    • Cap per-request context length at the edge with a clear reason, not fail mid-inference.
    • Share health checks for web and API but allow different degradation: pages can show queues and read-only history; APIs should fail fast so callers switch strategy.

    Callers should use exponential backoff, jitter, and a max retry count, and treat “length limit reached” as a business error that requires shortening context—not a transient error to retry forever.

    Releases, drills, and communication

    Stability belongs in the release process. Before new routing, truncation, or dependencies go live, compare error rate, token latency, and dependency timeout share on shadow or canary traffic; roll back automatically on anomaly. Avoid known peaks.

    Run regular failure drills: cut session storage, fill queues, simulate dependency timeouts. Verify that degraded copy, throttling, and scale-out take effect within the target time. A checklist that was never drilled often misses client retries under real traffic.

    External communication should stay factual: affected APIs, start and end time, user-visible symptoms, throttling or recovery actions, and follow-up (dependency isolation, capacity watermarks, rollback). If you offer credits or make-goods, rules should be computable in advance and explained by account consumption so verbal promises do not contradict invoices. Compensation is customer protection, not a substitute for root-cause work.

    On the brand side, repeated outages erode confidence in high-load capacity and cost control. Engineering should speak in metrics: availability over a window, error-budget burn, spare capacity, and whether repeat incidents went to zero. Do not replace engineering conclusions with unverified impact estimates or competitor comparisons.

    An executable order of work

    1. Unify error classes and user copy for capacity, dependency, release, and client issues.
    2. Rebuild the capacity model on token throughput, tail latency, and retry amplification; add early scale-out and graded throttling.
    3. Add timeout, isolation, and degradation on every sync dependency; session or billing failure must not masquerade as a vague length limit.
    4. Put quotas, idempotency, and context caps at the gateway to constrain retries.
    5. Canary releases with auto-rollback and periodic single-point drills.
    6. After an incident, publish scope and fixes; close compensation and reliability work on separate tracks.

    Availability of online intelligence services is the joint product of capacity, dependencies, and client behavior. Manage those as daily watermarks instead of a scramble after a viral outage, and each incident becomes reusable engineering asset rather than a continuity risk.