Correlated LLM Service Failures: Detection, Rate Limiting, and Tiered Degradation

    When multiple large language models fail at the same time, the root cause is rarely a single buggy component—it's usually shared infrastructure approaching saturation. This article explains how to distinguish correlated failures from isolated incidents, how to log and triage them with structured timelines, why shared coupling leads to cascading failures and retry storms, and how to combine capacity planning, token bucket rate limiting, and tiered degradation to keep core functionality available under pressure. Includes practical Python code for incident classification and rate limiting.

    1. Symptoms and Triage

    When several models start failing in quick succession, it is usually not an isolated error in one component. A single-point failure affects only one path. When multiple models are impacted during the same time window, it means shared underlying resources are near saturation and multiple request paths have lost their processing headroom simultaneously.

    Determining the nature of the failure is more useful than asking whether “the service is down.” The nature of the failure decides whether the team should wait for recovery or immediately switch to a fallback.

    Failure records discussed publicly tend to share three characteristics. First, long time spans—problems can persist from one day into the next. Second, broad impact—multiple models fail during the same window. Third, short but dense failure windows—each episode lasts tens of minutes, with very little gap between episodes.

    1.1 Recording Failures on a Timeline

    The first step in triaging correlated failures is to record each incident as a structured timeline. Suggested fields:

    Start Time End Time Affected Features Affected Models Error Type User-Facing Symptoms Concurrent Changes
    YYYY-MM-DD HH:MM YYYY-MM-DD HH:MM Chat, authentication, etc. Model names Timeout, rate limit, 5xx, auth failure Slower responses, error codes Config or release ID

    With a timeline in place, you can make initial judgments using these patterns:

    • Multiple models showing the same type of error in the same window: suspect a shared dependency or the gateway layer.
    • Only one feature is affected (e.g., login): check that feature’s independent dependency chain first.
    • Intervals between incidents shrink while scope expands: most likely capacity pressure.
    • All failures appear abruptly at once: most likely related to a configuration change or release.
    • Recurring intermittently over several days: capacity was never truly restored—temporary scheduling is just keeping things afloat.

    1.2 A Time-Overlap Screening Function

    The function below performs an initial screen using time-window overlap. Input times must be timezone-consistent datetime objects, otherwise the comparison will raise an error.

    1. def classify_incidents(incidents):
    2. """
    3. Initial screening: if two overlapping incidents involve different
    4. model sets, flag as a suspected shared-dependency problem.
    5. incidents: [(start_time, end_time, set_of_affected_models)]
    6. Times must be timezone-consistent datetimes; end time must be after start time.
    7. """
    8. valid = []
    9. for start, end, models in incidents:
    10. if end <= start:
    11. raise ValueError(f"End time must be after start time: {start} -> {end}")
    12. if not models:
    13. continue # Records with no affected models are excluded from classification
    14. valid.append((start, end, set(models)))
    15. if not valid:
    16. raise ValueError("No valid records; cannot classify")
    17. for i, (s1, e1, m1) in enumerate(valid):
    18. for s2, e2, m2 in valid[i + 1:]:
    19. overlap = s1 < e2 and s2 < e1 # Touching endpoints do not count as overlap
    20. if overlap and m1 != m2:
    21. return "Suspected shared resource or gateway issue"
    22. return "Suspected single-model or single-feature issue"

    This function is only a first pass. Conclusions must be confirmed together with metrics data and change records—it should never be treated directly as the root cause.

    2. Shared Coupling and Cascading Failures

    LLM services typically do not deploy full infrastructure separately for each model. The ingress gateway, authentication, request scheduling, inference clusters, caches, and storage are usually shared across models. Sharing reduces cost and improves utilization, but it also introduces coupling risk.

    Common coupling points include:

    • Unified gateway: connection counts, thread pools, and rate limit configurations are shared. A traffic burst on one model can crowd out connections for others.
    • Scheduling and queues: long-context requests and short requests are mixed together; long requests hold resources longer and drag down overall throughput.
    • Inference resource pool: accelerator memory, batch schedulers, and KV caches are shared. Memory fragmentation or frequent cache evictions affect all online models.
    • Identity and authentication: when login or auth depends on a failing component, users perceive multiple features as unavailable at once.
    • Configuration and releases: a single wrong rate limit threshold or routing rule can take effect across models.

    A typical cascading failure path looks like this: a resource pool approaches saturation and queue times grow. Clients time out and automatically retry, stacking retry traffic on top of the existing load, pushing queue times even higher. This loop is called a retry storm. It explains why failures spread within minutes, and why the service still takes time to recover even after the original trigger disappears.

    Clients should retry with exponential backoff plus random jitter, cap the maximum number of retries, and honor the server’s Retry-After header. Otherwise, the clients themselves become a source of amplified load.

    3. Capacity Headroom and Rate Limiting

    Inference cost correlates roughly with model parameter count. More parameters mean more compute and memory consumed per request. Context length, output length, and concurrency together determine KV cache occupancy. Capacity planning therefore cannot rely on requests per second alone—it must also account for effective token throughput per second and queue times at peak concurrency.

    3.1 Measuring Capacity Headroom

    “Scale out when average load reaches roughly 60–70% of peak capacity” is an empirical rule of thumb, not something to apply blindly. Two things need to be clarified first.

    First, which metric defines the water level. Use P95 queueing latency as the primary metric, with effective token throughput as a secondary signal. High GPU utilization does not mean there is no queueing—it often masks scheduling bottlenecks.

    Second, calibration. Run load tests with gradually increasing concurrency and record how effective token throughput and P95 queueing latency change. The knee point—where queueing latency begins to rise sharply—is that model’s peak capacity. Production load should stay below the knee point, with headroom reserved for traffic bursts.

    Scale-out lead times vary greatly by model size. The following orders of magnitude are for planning reference only and must be calibrated against real measurements in your environment:

    • Small models, with existing nodes and images, can usually be scaled out within hours.
    • Large models may require tens of minutes to hours for cross-node weight loading, warm-up, and compilation.
    • New hardware procurement and delivery is measured in weeks, so plan ahead.

    Break the scale-out timeline into segments for estimation: procurement or allocation, provisioning and environment setup, weight loading, warm-up and compilation, and gradual traffic ramp-up. Record actual durations for each segment during drills.

    3.2 Token Bucket Rate Limiting

    The goal of rate limiting is to reject a controlled subset of requests when the system approaches saturation, rather than letting every request slow down together. A token bucket allows a certain burst while constraining the long-term average rate.

    1. import threading
    2. import time
    3. class TokenBucket:
    4. def __init__(self, rate, capacity):
    5. if rate <= 0 or capacity <= 0:
    6. raise ValueError("rate and capacity must be positive")
    7. self.rate = float(rate) # Tokens added per second
    8. self.capacity = float(capacity) # Bucket capacity: max instantaneous burst
    9. self.tokens = float(capacity)
    10. self.updated = time.monotonic() # Monotonic clock, immune to system time changes
    11. self.lock = threading.Lock()
    12. def _refill(self, now):
    13. elapsed = now - self.updated
    14. self.tokens = min(self.capacity, self.tokens + elapsed * self.rate)
    15. self.updated = now
    16. def try_acquire(self, cost=1.0):
    17. with self.lock:
    18. if cost > self.capacity:
    19. return False # A single request exceeding bucket capacity can never pass; split it or reject
    20. self._refill(time.monotonic())
    21. if self.tokens >= cost:
    22. self.tokens -= cost
    23. return True
    24. return False

    Usage example:

    1. bucket = TokenBucket(rate=2000, capacity=8000) # 2000 tokens per second, burst cap 8000
    2. def handle(estimated_tokens):
    3. if not bucket.try_acquire(cost=estimated_tokens):
    4. return 429, {"Retry-After": "1"}
    5. return 200, None

    Key points in this code:

    • The deduction unit is the estimated token count, not a fixed 1. Long-context requests consume more quota, so rate limiting should match real load.
    • time.monotonic() does not go backward when system time is adjusted manually or automatically, making it suitable for measuring elapsed time.
    • The lock protects both refill and deduction, preventing duplicate token issuance across threads. This lock is only effective within a single process. For multi-process or multi-node deployments, the bucket state must live in shared storage (such as Redis) and be updated with atomic scripts.
    • When the limit is exceeded, return 429 with Retry-After. Interactive requests are generally unsuitable for long queueing, since user waiting amplifies retries. Batch jobs that tolerate delay can be queued instead.

    rate and capacity should be set per tenant or per model, based on effective token budgets derived from load testing. Start conservatively at launch, then increase gradually based on rejection rates and queueing latency.

    4. Tiered Degradation and Failure Isolation

    Rate limiting only controls the traffic entering the system. When capacity is genuinely insufficient, the system must also proactively reduce service quality to keep core functionality available.

    4.1 Tiered Degradation

    Degradation should proceed step by step, from high quality to low cost.

    1. Large models: the normal service tier—highest answer quality, highest resource consumption.
    2. Small and mid-size models: take over most traffic when large-model capacity runs short.