Ensuring LLM Chat Service Stability: Compute Scheduling and High-Availability Architecture Practices

    A major LLM chat platform recently faced compute shortages, imposed usage quotas, and suffered more than a dozen service incidents in just two months. This article analyzes how compute bottlenecks cascade into outages, and presents a systematic approach to capacity planning, rate limiting, graceful degradation, elastic architecture, and observability for LLM inference services. It offers practical guidance for teams building or operating large-scale AI serving infrastructure.

    Introduction: When an LLM Chat Service Starts Throttling

    Recently, a leading LLM chat platform began restricting users’ conversation quotas due to compute resource shortages, and suffered more than a dozen service incidents within just over two months. According to its public status records, the failures were concentrated in a two-month window, sometimes occurring twice in a single day. The incidents fell into two categories: performance degradation — slower responses, higher generation latency, and occasional request failures, where users still had some chance of success — and outright outages of the web interface and API endpoints. The most impactful incident lasted over four hours, affecting the consumer web app, the mobile chat service, and multiple API versions simultaneously.

    This incident is a warning for every team building or using LLM inference services: the tension between compute supply and business growth is becoming the core challenge to LLM service stability. This article breaks down the root causes of such failures from a technical perspective and outlines a systematic approach to building high availability.

    Part 1: Root Cause Analysis — How Compute Bottlenecks Cascade into Outages

    1.1 What Makes Inference Compute Different

    Unlike traditional web services, LLM inference is distinctly “resource-heavy”:

    • High per-request resource consumption: A single generation typically occupies tens of GB of GPU memory, which is simultaneously squeezed by model weights, the KV cache, and activation values.
    • Unpredictable request duration: Generative tasks use autoregressive decoding, so output token counts are unknowable in advance. The time a single request holds compute varies enormously — from one second to several minutes.
    • Hard hardware limits on concurrency: Traditional services can scale concurrency elastically by adding threads, but inference concurrency is strictly capped by physical GPU memory. Beyond that limit, requests can only queue.

    1.2 The Cascade from Supply–Demand Imbalance to Failure

    When user growth outpaces compute expansion, a classic failure cascade emerges:

    1. Request volume rises → inference queue backs up → time-to-first-token (TTFT) grows
    2. → users retry/refresh → request volume amplifies further (retry storm)
    3. → KV cache exhausted → batch request failures → gateway timeouts
    4. → service degrades and eventually goes down

    The “retry storm” deserves special attention: when users notice slow responses, they instinctively submit repeatedly, pushing an overloaded system further toward collapse. This is a key reason why performance degradation often escalates into a full outage — without effective self-protection mechanisms, overload is self-reinforcing.

    1.3 A Technical Reading of the Two Failure Modes

    Returning to the symptoms described above, they can be classified from an engineering standpoint:

    Performance degradation: The inference engine is still running, but scheduling queues are saturated — queue times increase, generation throughput (tokens/s) drops, and some requests are rejected by the gateway due to queue timeouts. The service is “available but unusable.”

    Outages: Overload triggers deeper problems — GPU memory exhaustion crashing inference instances, load balancer health checks failing at scale and removing nodes, or gateway connection pools draining. Recovery is costlier here because restarting instances requires reloading model weights, which can take minutes or longer.

    Part 2: Capacity Planning — Resolving the Supply–Demand Gap at the Source

    2.1 Building a Capacity Model

    The first step in capacity planning is quantifying demand. A useful estimation formula:

    1. Required concurrent instances ≈ (Peak QPS × Average inference duration) / Per-instance concurrency

    Per-instance concurrency depends on model size, GPU memory, KV cache management strategy, and quantization. In practice, obtain real numbers through load testing rather than relying on theoretical calculations — optimizations like continuous batching make throughput scale non-linearly with concurrency.

    2.2 Reserving Reasonable Headroom

    A rule of thumb: steady-state load should not exceed 60–70% of total cluster capacity. Beyond that, queuing latency rises sharply (a non-linear effect predicted by queueing theory), and the cluster loses its buffer for traffic spikes. For fast-growing workloads, also maintain a “capacity growth forecast” that ties expansion cycles to business projections — starting procurement several weeks ahead, since GPU delivery lead times are usually long.

    Part 3: Rate Limiting and Degradation — Self-Protection Mechanisms

    3.1 Multi-Layer Rate Limiting

    The platform’s “conversation quota” is essentially a rate limit, but a robust limiting strategy should be multi-layered:

    • User-level quotas: Cap daily conversations for free users and set higher rate limits for paying users, controlling total request volume at the source.
    • Gateway token-bucket limiting: Restrict requests entering the inference cluster per unit time; reject excess requests with a friendly message instead of letting them queue.
    • Queue-depth circuit breaking: When the inference queue exceeds a threshold, actively reject new requests with a “service busy” message to prevent retry storms.
    • Long-request interception: Cap the maximum input/output token count per request, preventing individual oversized requests from monopolizing compute.

    Illustrative rate-limiting logic:

    1. class RateLimiter:
    2. def allow_request(self, user):
    3. # Level 1: user quota check
    4. if not self.check_user_quota(user):
    5. return Reject("Daily conversation limit reached")
    6. # Level 2: global rate limiting
    7. if not self.global_token_bucket.acquire():
    8. return Reject("Service is busy, please try again later")
    9. # Level 3: queue protection
    10. if self.inference_queue.depth() > QUEUE_THRESHOLD:
    11. return Reject("System load is high, please retry later")
    12. return Accept()

    3.2 Tiered Degradation Plans

    When rate limiting alone cannot absorb the overload, trigger tiered degradation:

    1. Model degradation: Switch requests from large models to lighter ones, trading some quality for several times the throughput.
    2. Feature degradation: Disable expensive add-ons like web search or document parsing while keeping core chat.
    3. Experience degradation: Switch from streaming to batched output, or reduce the default maximum generation length.
    4. Scope degradation: Prioritize paying and API users while temporarily tightening free-tier quotas.

    The key to degradation is preparing in advance: all degradation switches must be developed and rehearsed before an incident occurs, not coded on the fly during one.

    Part 4: Elastic Architecture — Keeping Compute Supply Aligned with Demand

    4.1 Heterogeneous Scheduling and Mixed Deployment

    Different workloads have different latency sensitivity: consumer chat demands low latency, while batch annotation and offline summarization can tolerate delays. Engineering-wise, split traffic into online and offline classes — online traffic gets a dedicated high-performance inference pool, while offline jobs run on idle capacity during off-peak hours, improving overall utilization.

    4.2 Elastic Scaling of Inference Instances

    Implement autoscaling for inference instances on a container platform. Scaling metrics should not rely solely on CPU/GPU utilization — prioritize inference queue depth and time-to-first-token, which directly reflect user experience. Note that LLM instances have long cold-start times (loading model weights), so scaling policies should be forward-looking: use scheduled scaling for predictable morning/evening peaks, and predictive scaling for sustained growth trends.

    4.3 Multi-Region Disaster Recovery

    The four-hour outage exposed single-point-of-failure risk. Critical services should be deployable across availability zones and even across regions, so that when a single inference cluster fails, traffic can fail over to a backup cluster, keeping at least core functionality available.

    Part 5: Observability — Detecting Problems Before Users Do

    A complete monitoring and alerting system should cover four layers:

    Layer Key Metrics
    Infrastructure GPU utilization, memory usage, temperature, network bandwidth
    Inference engine Queue depth, batch size, KV cache occupancy
    Service quality Time-to-first-token, generation throughput (tokens/s), error rate
    User experience End-to-end success rate, user retry rate, session completion rate

    Pay special attention to alert severity for “golden signals”: a sustained climb in time-to-first-token is often the precursor to a major incident, and should trigger alerts — tied to automatic degradation — before users notice at scale.

    Part 6: Conclusion

    Building stable LLM services is a systems engineering effort: capacity planning determines whether resources are sufficient, rate limiting and degradation determine whether the system can protect itself under overload, elastic architecture determines whether supply can keep up with demand swings, and observability determines whether problems are caught early. For enterprises building their own inference services, mature cloud platform capabilities can accelerate the path — for example, using general-purpose offerings such as elastic compute, container platforms, and monitoring/alerting from providers like Baidu AI Cloud to quickly stand up inference infrastructure with autoscaling and self-healing, freeing teams to focus on models and business rather than re-building high-availability foundations from scratch.