Why Large Language Model Services Go Down: Causes and High-Availability Architecture Design

    Large language model services can fail across web, mobile, and API channels simultaneously, and the root cause usually lies in shared server-side layers rather than any single client. This article breaks down the failure chain of an LLM service into five layers, explains how cascading overloads happen, and covers practical high-availability techniques: capacity planning with Little's Law, token-bucket rate limiting, tiered degradation, multi-zone disaster recovery, idempotent retries, circuit breakers, and observability—with runnable Python examples.

    1. What the Incident Means Technically

    One afternoon, a large language model chat service experienced a widespread outage. Users reported stalled page loads and failed message delivery; API calls made by developers kept returning errors, and in-progress document parsing and code generation tasks were interrupted. The failure hit the web app, mobile apps, and API endpoints at the same time, which indicates the problem was not in any single page or client, but in a shared server-side component.

    No official root-cause analysis has been published, so this article does not speculate about that specific incident. Instead, it breaks this class of failure into layers that can be analyzed one by one, and discusses the common risks and mitigations at each layer.

    2. The Failure Chain of an LLM Service

    A conversation request typically passes through five stages from the user’s device to the model’s output:

    1. Access layer: DNS resolution, load balancing, gateway authentication, and ingress rate limiting.
    2. Scheduling layer: request queuing, batching, and routing to specific inference instances.
    3. Compute layer: a pool of accelerator cards responsible for the model’s forward pass.
    4. State layer: data that must be persisted, such as conversation context, user quotas, and usage metering.
    5. Client layer: timeout and retry logic in browsers, mobile apps, and third-party SDKs.

    A bottleneck at any layer propagates upstream. For example, if per-request inference latency rises at the compute layer, the queue at the scheduling layer grows; once the gateway times out, clients retry automatically, and the new requests add even more load to the compute layer. This positive feedback loop is the classic path to a cascading failure in LLM services. When troubleshooting, first identify which layer is the bottleneck, then decide whether to scale out, throttle, or fix the logic.

    3. Capacity Planning: Start from the Peak

    A single LLM inference request takes a relatively long time, and the output length is unpredictable, so capacity estimation cannot rely on average request volume alone. Little’s Law can be used to estimate the number of requests being processed concurrently:

    Concurrent requests ≈ arrival rate × average occupancy time

    The following example computes the number of instances required at peak request rate. The numbers are for demonstration only; real values should come from load testing and production monitoring.

    1. import math
    2. def required_instances(peak_qps: float, avg_latency_s: float,
    3. per_instance_concurrency: int,
    4. headroom: float = 0.3) -> int:
    5. """Estimate the number of inference instances needed at peak.
    6. headroom is the reserved redundancy ratio."""
    7. concurrent = peak_qps * avg_latency_s
    8. base = math.ceil(concurrent / per_instance_concurrency)
    9. return math.ceil(base * (1 + headroom))
    10. # Example: 50 QPS at peak, 8s average latency, 16 concurrent requests per instance
    11. print(required_instances(50, 8, 16)) # outputs 33

    The purpose of reserved headroom is to cover the scaling window. Traffic spikes arrive within seconds, while provisioning a new instance, loading the model, and passing health checks can take minutes. The headroom must at least cover the incremental traffic during that window—otherwise, no matter how fast autoscaling is, it cannot absorb the first wave of the surge.

    4. Rate Limiting and Tiered Degradation

    The goal of rate limiting is to keep the system under control when overloaded, rather than letting every request slow down together. A common token bucket implementation looks like this:

    1. import time
    2. class TokenBucket:
    3. def __init__(self, rate: float, capacity: int):
    4. self.rate = rate # tokens refilled per second
    5. self.capacity = capacity # bucket capacity, determines the allowed burst
    6. self.tokens = float(capacity)
    7. self.updated = time.monotonic()
    8. def allow(self) -> bool:
    9. now = time.monotonic()
    10. elapsed = now - self.updated
    11. self.tokens = min(self.capacity, self.tokens + elapsed * self.rate)
    12. self.updated = now
    13. if self.tokens >= 1:
    14. self.tokens -= 1
    15. return True
    16. return False

    A token bucket inside a single process is only useful for understanding the principle. In production, rate limiting should be enforced at the gateway layer along tenant, endpoint, and model dimensions, with counter state kept in shared storage. Rejected requests should receive a 429 status code, and the Retry-After response header should tell the client how long to wait, so clients do not retry blindly.

    Degradation strategies can be designed in tiers:

    • Tier 1: allow queuing, but return an estimated wait time to users and keep connections alive.
    • Tier 2: shorten the maximum output length and pause resource-intensive features, such as high-precision parsing of large files.
    • Tier 3: stop admitting new sessions and prioritize completing existing sessions and long-running tasks.

    Each tier should have explicit trigger and recovery conditions, and the switchover process should be validated in drills.

    5. Multi-AZ Disaster Recovery and Elastic Compute

    A power failure, network partition, or exhausted resource pool in a single availability zone can take down the entire service. A high-availability design typically includes:

    • Cross-AZ deployment: inference clusters are distributed across multiple availability zones, and traffic is shifted by weight to other zones when one fails.
    • Pre-warmed elastic compute pool: a set of standby instances with models already loaded, reducing scale-out time from minutes to seconds.
    • Multi-replica metadata: critical data such as sessions and quotas uses multi-replica storage, avoiding state loss from a single point of failure.
    • Regular fault injection: deliberately shut down instances or simulate network latency to verify that failover logic behaves as expected.

    Disaster recovery targets should be defined in advance. Recovery Time Objective (RTO) is the maximum acceptable time to restore service after a failure; Recovery Point Objective (RPO) is the maximum acceptable window of data loss. Both should align with what the business can tolerate, and drills should confirm the system can actually meet them.

    6. Consistency Across Multiple Clients

    The web app, mobile apps, and API clients may act on the same session at the same time. After a network interruption, retried requests can produce duplicate messages, and the intermediate state of long-running tasks may be lost. Addressing these problems requires three design elements:

    1. Idempotency keys: assign a unique idempotency key to each logical request. The server records processed keys and returns the original result for duplicates.
    2. Versioned sessions: session state carries a version number. When a client reconnects, it pulls the latest version, avoiding stale content.
    3. Resumable long-running tasks: tasks such as document parsing and code generation are split into stages, with a checkpoint written after each stage completes. After an interruption, the task resumes from the most recent checkpoint.

    The following client example shows how to combine an idempotency key with exponential backoff:

    1. import random
    2. import time
    3. import uuid
    4. import requests
    5. def call_with_retry(url: str, payload: dict, max_retries: int = 3) -> dict:
    6. # All retries of the same logical request share one idempotency key,
    7. # which the server uses for deduplication
    8. headers = {"Idempotency-Key": str(uuid.uuid4())}
    9. for attempt in range(max_retries + 1):
    10. try:
    11. resp = requests.post(url, json=payload, headers=headers, timeout=30)
    12. except requests.RequestException:
    13. retryable = True
    14. else:
    15. if resp.status_code < 400:
    16. return resp.json()
    17. retryable = resp.status_code == 429 or resp.status_code >= 500
    18. if not retryable:
    19. # Other 4xx errors indicate a problem with the request itself;
    20. # retrying is pointless
    21. resp.raise_for_status()
    22. if attempt == max_retries:
    23. raise RuntimeError("Retry attempts exhausted")
    24. # Exponential backoff with random jitter to avoid many clients
    25. # retrying at the same moment
    26. time.sleep(min(30, 2 ** attempt) + random.uniform(0, 1))

    This example does not handle the Retry-After header. In a real implementation, if the server returns this header, its specified wait time should take precedence.

    7. Circuit Breaking and Client Experience

    A circuit breaker prevents clients from continuously hitting a service that is already failing. It typically has three states:

    • Closed: requests are forwarded normally, and the failure rate is tracked.
    • Open: once the failure rate exceeds a threshold, requests are rejected immediately without touching the backend.
    • Half-open: after a cooldown period, a small number of probe requests are allowed through. If the probes succeed, the breaker returns to closed; if they fail, it reopens.

    Clients should also provide fallbacks at the experience level. User input should be saved locally as a draft so it is not lost even if the request fails. The interface should clearly distinguish between “network error,” “service busy,” and “content policy violation” so users can judge whether waiting is worthwhile.

    8. Observability and Incident Response

    Without metrics, troubleshooting a failure is pure guesswork. At a minimum, the following metrics should be monitored: