Handling LLM Service Interruptions: Retries, Degradation, and Status Monitoring
Large Language Model (LLM) inference services are prone to partial interruptions due to GPU resource constraints and complex upstream dependencies. This article explores the root causes of LLM service outages and provides practical strategies for developers to mitigate their impact. It covers how to integrate provider status pages into your monitoring system, design effective fallback and rate-limiting mechanisms, and implement client-side fault tolerance using exponential backoff and targeted error retries.
1. Event Review: Partial Interruptions Impact Business
According to public status page records, an LLM service platform once experienced chat function anomalies, prompting users with “Server busy, please try again later.” Both web chat and some API interfaces were affected for nearly two hours before recovery. Exact start and end times should be verified against the historical events on the status page.
A key characteristic of such events is “partial interruption”: the overall site remains accessible, but specific functions fail. For API-dependent applications, the consequences include chat failures, backlogs in asynchronous tasks, and increased user wait times. Developers must design proactive solutions rather than waiting for a failure to occur to handle it temporarily.
2. Root Causes: Why Inference Services Easily Become “Busy”
LLM inference has different resource characteristics compared to traditional web services. Inference relies on GPUs, with long single-request durations and high resource consumption. There are four common triggers:
- Compute Contention: Viral topics or activities trigger request peaks, leading to inference queue backlogs. Gateways begin rate-limiting or rejecting requests, causing users to see “Server busy.”
- Upstream Dependency Cascading Failures: Jitters in any single link—whether load balancing, caching, message queues, or authentication services—can propagate downstream.
- Deployment Risks: Model version updates, configuration changes, or scaling operations without proper canary releases and rollback mechanisms can cause brief unavailability.
- Network and Datacenter Issues: Regional network jitters or single Availability Zone (AZ) failures can cause access anomalies in specific areas.
Providers typically address these through capacity planning, multi-AZ deployment, and full-link stress testing. For capacity planning, start by defining the stress test metrics: target 1.5x the peak request volume and observe Time to First Token (TTFT) and queue times. Scale-out thresholds can be set for when queue wait times exceed a certain number of seconds, or when GPU utilization remains above 70% to 80% for several minutes. (Note: these values are examples and should be adjusted based on your own business stress test results.) Rate limiting should be tiered, prioritizing paid online requests over offline batch processing. Degradation priorities must also be established in advance—for instance, first disabling long context and web search, followed by reducing the maximum output length.
3. Integrating Status Pages: Incorporating Upstream Health into Monitoring
A standardized status page typically consists of three parts: real-time status by service (web, API, auth, file services), historical event archives (timelines, impact scope, root cause post-mortems), and subscription notifications (email, Webhook).
Before integrating, confirm three things: whether the provider offers a public status interface, whether the interface requires authentication, and if there are rate limits. If there is no public API or Webhook, use official subscription emails or in-site notifications and manually confirm before taking action. If an API is available, follow this integration flow:
- Scheduled Polling: Request the status interface at a reasonable interval (e.g., 60 seconds), with timeouts and caching enabled to prevent your monitoring from adding extra load.
- Field Mapping: Map the provider’s status fields (e.g., operational, degraded, major_outage) to your internal alert severity levels.
- Alert Deduplication: Send only one notification for the same event within a given timeframe, and send a recovery message when the status is restored.
- On-call Notification: High-severity alerts trigger phone or instant messaging alerts, while low-severity alerts are simply logged.
- Recovery Confirmation: Once status is restored, send a small real probe request to confirm that the business service is actually available.
4. Client-side Fault Tolerance: Only Retry Retryable Errors
Faced with sporadic interruptions, callers must implement defenses at the code level. The following example does three things: it only retries network errors and HTTP 429, 502, 503, and 504 status codes; it prioritizes the Retry-After header returned by the server; and it directly throws client errors like 400, 401, 403, and 404 without retrying.
import randomimport timeimport requestsENDPOINT = "https://your-endpoint/v1/chat"RETRYABLE_STATUS = {429, 502, 503, 504}def call_llm_api(prompt, max_retries=5, total_timeout=120):"""Exponential backoff retry. Only for idempotent requests, or requests where the server supports idempotency keys."""backoff = 1.0start = time.monotonic()last_error = Nonefor attempt in range(1, max_retries + 1):if time.monotonic() - start > total_timeout:breakwait = backoff + random.uniform(0, 1) # Add random jitter to avoid multiple clients retrying simultaneouslytry:resp = requests.post(ENDPOINT,json={"messages": [{"role": "user", "content": prompt}]},timeout=(5, 30), # (connect timeout, read timeout))except (requests.
