Disaster Recovery Design and Incident Response for Large Model Services
This article explores practical strategies for disaster recovery and incident response in large language model services. It covers decomposing incident impacts, identifying common causes from resource imbalances to single-point dependencies, quantifying availability goals, and implementing client-side fault tolerance and server-side degradation. Readers will also learn about state protection for long-running tasks, observability best practices, and a comprehensive checklist to ensure system resilience during unexpected outages.
1. Event Characteristics and Impact Decomposition
When large model services experience widespread anomalies, users typically observe several symptoms simultaneously: pages stuck in loading states, unresponsive message submissions, inconsistent behavior across different terminals for the same account, and continuous error codes from programmatic API calls. These symptoms usually point to a single issue: a shared component in the request chain has failed, affecting multiple access endpoints.
The impact can be decomposed into three layers, each requiring different remediation approaches:
- Interaction Layer: Web and mobile sessions are interrupted, and unsaved user inputs may be lost.
- Business Layer: Long-running tasks like document parsing and code generation are forced to terminate, consumed compute resources are difficult to reclaim, and task progress cannot be retained.
- Integration Layer: Business processes integrated via APIs fail, causing downstream systems to receive timeouts or error responses, potentially resulting in dirty data or duplicate processing.
The value of layered analysis is that teams can first determine which layer is most severely affected and then prioritize which request chain to restore first.
2. Common Causes: From Resources to Links
The following are common causes of failures in the industry, rather than conclusions from a specific incident.
- Compute Supply and Demand Imbalance: Inference services rely on accelerator chip clusters. New version rollouts, feature gradual rollouts, or sudden traffic spikes can cause instantaneous loads to exceed the cluster’s designed capacity. When resources are tight, the scheduler queues or rejects new requests, manifesting as stuck loading and request timeouts.
- Rate Limiting and Quota Strategy Misfires: Rate limiting rules designed to protect clusters can prematurely restrict normal users if thresholds are too tight or metering statistics are skewed. In logs, this often appears as a surge of 429 responses, while the server’s actual load remains below the limit.
- Single-Point Dependencies: If shared components like authentication, session storage, and billing statistics run on a single set of instances, an anomaly in any one component can escalate into a site-wide outage.
- Change Risks: If model iterations, configuration adjustments, or cache policy changes are deployed during peak hours, the rollback window is very short, and the impact scales with traffic.
During troubleshooting, it is crucial to distinguish between resource issues, strategy issues, and dependency issues, as their resolution paths are entirely different.
3. Translating Availability Goals into Executable Metrics
Availability goals must be quantified to guide engineering decisions. Three commonly used concepts are:
- SLA (Service Level Agreement): The external service commitment, usually written into contracts or terms of service.
- SLO (Service Level Objective): The internal team’s service target, typically stricter than the SLA to provide a buffer.
- Error Budget: The tolerable failure ratio calculated as 1 minus the SLO, used to determine release cadence and risk tolerance.
For example, with a 30-day statistical period and an SLO of 99.9%, the error budget is approximately 43.2 minutes. This means if the cumulative downtime in a month exceeds this value, high-risk changes should be paused, and stability issues prioritized.
Metrics must also be split by client endpoint, rather than just looking at overall averages. It is recommended to cover at least the following dimensions:
- Web client first-screen load success rate;
- Message submission success rate and end-to-end latency;
- API call success rate, grouped by error codes;
- Long-running task completion rate and average queue time.
Multi-terminal consistency should also be factored into the design. The authoritative state of a session should be stored on the server, with the client only handling caching and display. This way, even if a terminal reconnects, it can recover a consistent context from the server.
4. Client-Side Fault Tolerance Design
The client is the frontline where users perceive failures, and reasonable fault tolerance logic can absorb most brief fluctuations.
Design should follow these principles:
- Retries should only apply to idempotent requests or requests where the server supports deduplication. Retrying non-idempotent operations may result in duplicate charges or duplicate generations.
- Use exponential backoff with random jitter to prevent a large number of clients from retrying simultaneously, creating a retry storm.
- Set a total timeout to prevent a single request from waiting indefinitely and occupying connections.
- Retry on 429 and 5xx errors; for 4xx business errors, return directly without making meaningless repeated calls.
Below is a schematic retry wrapper to illustrate the judgment logic and backoff strategy:
import randomimport timeRETRYABLE_STATUS = {429, 500, 502, 503, 504}def call_with_backoff(send, max_attempts=5, base_delay=0.5, max_delay=20.0):"""send() returns (status_code, body), retries only for retryable status codes."""for attempt in range(1, max_attempts + 1):status, body = send()if status < 400:return bodyif status not in RETRYABLE_STATUS or attempt == max_attempts:raise RuntimeError(f"Request failed with status code {status}")# Exponential backoff with full jitter to disperse retry times across clientsdelay = min(max_delay, base_delay * (2 ** (attempt - 1)))time.sleep(random.uniform(0, delay))
Beyond retries, clients should do two more things. First, generate an idempotency key for each submission so the server can identify duplicate requests. Second, save unsent drafts locally so they can be submitted after recovery, preventing users from retyping.
When a dependency continuously fails beyond a threshold, the client can trigger a circuit breaker, failing fast and displaying a clear prompt instead of keeping users waiting. After a period, the circuit breaker enters a half-open state, allowing only a few probe requests to verify if the dependency has recovered before fully resuming.
5. Server-Side Disaster Recovery and Degradation
The server’s goal during resource shortages is to ensure the most critical requests are still completed, rather than slowing down all requests.
- Multi-AZ Deployment: Distribute critical components across different availability zones so traffic can switch to other zones if a single region fails.
- Capacity Planning: Capacity should be based on historical peaks plus an appropriate buffer. The buffer ratio should be calculated based on business volatility data, not fixed by guesswork.
- Admission Control: Under high load, queue new sessions and prioritize continuation requests for existing sessions to minimize mid-conversation interruptions.
- Tiered Degradation: Rank features by importance, e.g., core dialogue first, followed by file parsing, and finally batch tasks. Degradation switches should be pre-configured and rehearsed regularly.
- Elastic Scaling: Scaling signals should include queue length and request latency, not just CPU utilization. The bottleneck for inference workloads is often not the CPU.
6. State Protection for Long-Running Tasks
Long-running tasks like document parsing and code generation are most vulnerable to interruptions. The solution is to break tasks into recoverable steps and periodically save checkpoints.
Specific practices include:
- Break down long tasks into several sub-steps, recording a checkpoint after each step is completed.
- Write intermediate results to persistent storage, such as object storage services, rather than keeping them only in memory.
- Maintain a clear task state machine, including five states: Queued, Running, Paused, Completed, and Failed.
- Upon failure, resume from the most recent checkpoint rather than executing from scratch.
This design adds some storage and scheduling overhead but significantly reduces redundant computation and user wait times caused by failures.
7. Observability and Incident Response
The monitoring system should cover both technical metrics and user-perceived metrics. It is recommended to focus on endpoint-specific success rates, time to first token, queue times, error code distributions, and abnormal fluctuations in Token consumption. These metrics help teams identify issues before users report them on a large scale.
Alerts should be tiered by severity and synchronized with the public status page. Communication during an incident hinges on three points:
- Publish confirmed impact scopes as early as possible, even if the root cause is not yet clear.
- Explain the measures taken to prevent users from repeatedly refreshing and adding to the load.
- Provide a time for the next update and deliver on it.
After the incident is resolved, conduct a post-mortem. The report should include a timeline, root cause analysis, impact scope, and action items. Each action item must have a clear owner and deadline; otherwise, the same issues will recur.
8. Implementation Checklist
- Check if core request chains have single-point dependencies;
- Verify if client retries include a backoff strategy and attempt limits;
- Ensure non-idempotent operations have a deduplication mechanism;
- Confirm long-running tasks can resume from checkpoints;
- Validate if degradation switches have been rehearsed;
- Check if incident notification templates and responsible parties are designated.
