LLM Service Outage: Stability Engineering for High-Concurrency Inference
This article examines an LLM service incident that spanned two days and affected multiple model inference endpoints alongside a brief third-party authentication anomaly. It explains how to assess whether failures are correlated, share dependencies, or spread across entry points; why shared infrastructure can cascade under load; how retry storms, resource saturation, connection exhaustion, and hidden component coupling amplify outages; and how tiered routing, rate limiting, circuit breaking, backoff with jitter, degradation, capacity planning, stress testing, observability, and blameless postmortems can contain impact. The article includes practical Python examples for routing, token-bucket limiting, circuit breaking, and retry logic, and concludes with an implementation sequence for teams operating LLM services.
1. Incident Symptoms and Initial Assessment
Recently, some users reported anomalies in an LLM service, and the incident spanned two days. According to public status records, the failures were not concentrated on a single endpoint. Within a roughly ten-minute window, inference requests for multiple models failed in succession, accompanied by a brief anomaly in the third-party authentication path.
When facing this type of situation, engineering teams usually assess the nature of the failure first. The assessment can start with three dimensions:
- Correlation: whether failures are concentrated in the same time period and have clear temporal relationships with one another.
- Sharing: whether the affected services depend on the same compute resources, gateway, scheduler, or storage components.
- Coverage: whether the anomaly spreads to different business entry points, such as inference, login, and the console.
If multiple seemingly independent modules become abnormal in the same time window, the likelihood of a single-point code defect decreases, while the likelihood of shared-dependency problems increases, such as resource-pool exhaustion, gateway overload, or a chain reaction caused by a configuration change. During troubleshooting, teams should first map the dependency topology and then investigate bottlenecks layer by layer along shared nodes.
2. Why Shared Infrastructure Is Prone to Cascading Failure
Cascading failure refers to local overload being amplified level by level through the call chain, ultimately making the entire system unavailable. In LLM inference scenarios, common amplification paths include the following.
2.1 Resource Pools Saturated at the Same Time
Inference services usually depend on AI accelerators, memory, and high-speed networks. When request volume exceeds processing capacity, requests accumulate in queues, queueing time grows, and clients may resend requests after timeouts. The longer the queue, the longer each request waits, and the system’s effective throughput may actually decline.
2.2 Retry Amplification
Automatic retries at the client and middleware layers are common amplifiers. Suppose each request is retried twice after failure. When the downstream is already overloaded, the actual load reaching it may approach three times the original traffic. This phenomenon is often called a retry storm. The correct approach is to limit the number of retries and use exponential backoff with jitter so that clients do not all resend requests at the same moment.
2.3 Connection and Thread Exhaustion
Once the connection pools and thread pools of gateways and business services are exhausted, even if the backend has recovered, new requests may still fail because they cannot obtain connections. Recovery from this type of problem often takes longer than fixing the root cause, so isolation and degradation mechanisms should be reserved during the design phase.
2.4 Hidden Coupling of Shared Components
Common components such as identity authentication, configuration centers, and log collection may appear unrelated to business logic, but once these components respond slowly, all businesses that depend on them are affected. During incident review, teams should specifically inspect these “hidden shared points.”
3. Inference Cost and Capacity Pressure of Large Models
Model parameter scale directly affects memory usage, compute time, and concurrency capacity for a single inference request. As parameter count increases, the resources consumed by each request grow significantly, while throughput may not increase proportionally. Therefore, the cost of scaling often grows nonlinearly.
This means operators need to consider three types of pressure at the same time:
- Peak pressure: concurrency during peak periods is far higher than the average, so capacity must be planned based on peaks rather than averages.
- Long-tail pressure: a small number of long-text or complex reasoning requests consume substantial resources and slow down overall response.
- Cold-start pressure: new instances need time to load models, so scaling does not take effect instantly.
If the system has only a single large model pool, all requests enter the same set of high-cost resources, and any traffic fluctuation is directly amplified onto the core inference cluster. This is a primary reason for introducing tiered routing.
4. Tiered Routing and Traffic Splitting
The idea behind tiered routing is to let simple requests be handled by lightweight models, while only requests that truly require complex reasoning enter the large model pool. This is a relatively common model cascading and routing approach in the industry, capable of reducing overall cost and relieving peak pressure while maintaining quality.
Routing decisions can be based on the following signals:
- Input length and expected output length;
- Task type, such as classification, summarization, code generation, and multi-step reasoning;
- User tier and service-level agreement;
- Current load watermarks of each resource pool.
Below is a simplified routing example to illustrate the decision logic:
from dataclasses import dataclass@dataclassclass Request:text: strmax_tokens: intneeds_reasoning: booldef estimate_complexity(req: Request) -> str:if req.needs_reasoning or req.max_tokens > 2048:return "large"if len(req.text) > 1000:return "medium"return "small"ROUTE_TABLE = {"small": "small-model-pool","medium": "medium-model-pool","large": "large-model-pool",}def route(req: Request) -> str:return ROUTE_TABLE[estimate_complexity(req)]
In real systems, complexity estimation usually needs to be calibrated against historical data and offline evaluation results. Thresholds should not be fixed based on experience alone; they should be determined by comparing quality and latency across different models on various tasks. At the same time, the routing layer also needs a fallback strategy: when the large model pool watermark is too high, acceptable requests can be degraded to medium-sized models, and the result source should be clearly labeled to the user.
5. Rate Limiting, Circuit Breaking, and Degradation
Tiered routing solves the question of “where requests go,” while rate limiting, circuit breaking, and degradation solve the question of “how much the system can handle.” Used together, they can keep the failure scope within acceptable boundaries.
5.1 Token Bucket Rate Limiting
The token bucket algorithm allows a certain degree of burst traffic while limiting the long-term average rate. It is one of the most widely used rate-limiting methods.
import threadingimport timeclass TokenBucket:def __init__(self, rate: float, capacity: int):self.rate = rateself.capacity = capacityself.tokens = float(capacity)self.updated = time.monotonic()self.lock = threading.Lock()def allow(self, cost: int = 1) -> bool:with self.lock:now = time.monotonic()elapsed = now - self.updatedself.tokens = min(self.capacity, self.tokens + elapsed * self.rate)self.updated = nowif self.tokens >= cost:self.tokens -= costreturn Truereturn False
Rate-limiting thresholds should be differentiated at three levels: users, endpoints, and model pools, to prevent a large number of requests from a single user from crowding out resources for other users.
5.2 Circuit Breaker
When the downstream fails continuously, the circuit breaker temporarily rejects requests to give the downstream time to recover. After a cooling period, the circuit breaker enters the half-open state and allows a small number of probe requests. If the probes succeed, normal operation resumes.
import timeclass CircuitBreaker:def __init__(self, failure_threshold: int = 5, reset_timeout: float = 30.0):self.failure_threshold = failure_thresholdself.reset_timeout = reset_timeoutself.failures = 0self.opened_at = Nonedef call(self, fn, *args, **kwargs):if self.opened_at is not None:if time.monotonic() - self.opened_at < self.reset_timeout:raise RuntimeError("circuit open")self.opened_at = None # enter half-open state and allow probe requeststry:result = fn(*args, **kwargs)except Exception:self.failures += 1if self.failures >= self.failure_threshold:self.opened_at = time.monotonic()self.failures = 0raiseself.failures = 0return result
5.3 Exponential Backoff Retry with Jitter
Retries should have an upper limit, and intervals should be randomized; otherwise, many clients will hit the downstream again at the same moment.
import randomimport timedef retry_with_backoff(fn, max_attempts: int = 3, base: float = 0.2):for attempt in range(max_attempts):try:return fn()except Exception:if attempt == max_attempts - 1:raisedelay = base * (2 ** attempt) + random.uniform(0, base)time.sleep(delay)
5.4 Degradation Strategies
The goal of degradation is to preserve the most basic service value when core capabilities are unavailable. Common practices include:
- Returning cached historical results, suitable for queries whose results do not change frequently;
- Disabling non-core features, such as complex multi-turn reasoning or additional structured output;
- Queueing requests and informing users of the estimated wait time instead of directly returning an error;
- Transferring requests to a backup model pool and labeling the actual processor in the response.
6. Capacity Planning and Stress Testing
The core of capacity planning is converting business growth forecasts into resource demand. The general process is as follows:
- Collect historical peaks and calculate the ratio of peak to average.
- Based on expected business growth, project peak concurrency for the next three to six months.
- Set watermarks for each resource pool, for example, starting scaling when utilization reaches 70%.
- Reserve failure redundancy to ensure that remaining resources can still handle critical traffic when a single availability zone or node fails.
Stress testing should cover the following scenarios:
- Step load: gradually increase concurrency and observe the throughput inflection point and latency changes.
- Long-tail request testing: mix in a certain proportion of long-text requests to verify whether queue and timeout configurations are reasonable.
- Dependency fault injection: artificially slow down the authentication service or cache to verify whether circuit breaking and degradation take effect as expected.
- Recovery testing: simulate the traffic surge after fault recovery to check whether the system becomes overloaded again.
Stress test results should be documented as a baseline and revalidated after each architecture change.
7. Observability and Incident Postmortem
Effective monitoring is a prerequisite for rapid problem localization. It is recommended to collect at least the following metrics and display them separately by model pool, endpoint, and region:
- Request success rate and error code distribution;
- First-token latency and tail latency, such as P99;
- Queue length and queueing time;
- Retry rate and number of circuit breaker trips;
- Utilization and memory usage of each resource pool.
Alerts should be based on trends and composite conditions rather than a single threshold. For example, when “success rate declining” and “queue length growing rapidly” occur at the same time, this is more indicative of a problem than a single metric exceeding its threshold.
Incident postmortems should be conducted in a blameless manner and include the following:
- Timeline: key events recorded to the minute;
- Impact scope: affected endpoints, user groups, and duration;
- Root cause analysis: distinguishing triggering factors from amplifying factors;
- Action items: each improvement should have an owner, deadline, and validation method;
- Lessons learned: updating runbooks and alert rules.
8. Implementation Recommendations
For teams building or operating LLM services, the following sequence can be used:
- Map shared dependencies and draw the complete call chain from entry points to the inference cluster.
- Set timeouts, retry limits, and circuit breaker protection for all external calls.
- Establish a tiered routing mechanism to divert simple requests away from the core model pool.
- Set rate limits by user and endpoint, and prepare contingency plans for degradation paths.
- Plan capacity based on peak traffic, and regularly perform stress tests and fault drills.
- Improve observability so that each model pool has its own dashboard and alerts.
Stability is not the result of any single technology; it is the product of capacity, routing, protection, and postmortem review working together. During rapid traffic growth, the earlier teams establish these mechanisms, the more effectively they can contain the impact of failures within a local scope.
