Large Model API Outages: Availability Assurance and Disaster Recovery Design Practices
This article examines service outages in online large model APIs, from user-visible symptoms and common root causes to availability goals, architecture-level disaster recovery, client retry and idempotency design, degradation strategies, capacity planning, release management, monitoring, and failure drills. It provides a structured reference for teams that need to improve both request success rates and long-task recovery during backend failures.
1. Failure Symptoms and Impact Scope
Failures in online large model services usually do not appear only as “the service will not open.” From the user side, there are at least four common symptoms:
- Front-end loading anomaly: A web page or client stays in a loading state for a long time, and the first screen cannot render.
- Request send failure: A message is submitted but receives no response, or a gateway-level error is returned.
- Persistent API errors: When developers call the API, rate-limit, overload, or internal error codes are returned, and the business process cannot complete.
- Streaming output interruption: The connection drops during generation, already-output content is lost, and a long task has to restart from the beginning.
When multiple clients are affected at the same time, the failure is often located in a shared backend layer, such as the inference cluster, gateway, or authentication service, rather than in a defect of one client. When the same backend serves the web client, mobile client, and API callers at the same time, an anomaly on one node can be amplified along the call chain into a global impact.
For paid users and enterprise users, the impact also appears in business continuity. Tasks such as document parsing, code generation, and batch data processing usually take a long time, and the cost of interruption is much higher than that of a single failed request. Therefore, availability design needs to consider both “whether a request can succeed” and “whether a task can recover.”
2. General Analysis of Failure Causes
Failures in large model services are often formed by a combination of the following causes.
2.1 Mismatch Between Compute Resources and Burst Traffic
The capacity of an inference cluster is determined jointly by the number of accelerator cards, memory capacity, and scheduling policy. Long-text requests consume far more memory and computation time than short Q&A requests, and a single high-load request can occupy a large amount of resources. When traffic hits the upper limit within a short period, the scheduling queue backs up quickly, queuing latency rises, and timeouts and rejections are eventually triggered.
2.2 Traffic Impact from Releases
When a new model or feature is released, it is often accompanied by a large number of users trying it at the same time, and the access peak may far exceed the normal level. If sufficient load testing and canary release are not performed before release, the capacity gap will be exposed on the release day.
2.3 Rate-Limit and Quota Accounting Anomalies
To protect the cluster, services usually set request frequency limits and token quotas. If the metering module has accounting deviations, normal users may be incorrectly rate-limited, or users who exceed quotas may not be blocked in time. The impact of this type of problem on developers is often more hidden than a full outage and requires dedicated monitoring coverage.
2.4 Coupling Between Control Plane and Data Plane
When control-plane services such as authentication, session management, and billing fail, users still cannot use the service even if the inference cluster itself is normal. Decoupling the control plane from the inference data plane is a common way to reduce the failure surface.
3. Availability Goals and Metrics
Before designing a disaster recovery solution, availability goals need to be clarified. Service level objectives (SLOs) are usually expressed as an availability rate. Calculated over 30 days, 99.9% availability allows about 43.2 minutes of unavailability, and 99.95% allows about 21.6 minutes. The higher the goal, the greater the redundant resources and operations costs required, and the team needs to make trade-offs based on business value.
It is recommended to track at least the following metrics:
| Metric | Meaning | Reference Use |
|---|---|---|
| Request success rate | Ratio of successful responses to total requests | Determine overall availability |
| First-token latency | Time from sending a request to receiving the first output chunk | Reflect queuing and scheduling pressure |
| Streaming interruption rate | Ratio of abnormal disconnections during generation | Reflect network and backend stability |
| Rate-limit hit rate | Proportion of requests returning rate-limit errors | Determine whether capacity is sufficient |
| Task recovery rate | Proportion of long tasks successfully resumed after interruption | Measure disaster recovery effectiveness |
These metrics should be counted separately by region, API type, and customer tier to avoid overall averages masking local failures.
4. Architecture-Level Disaster Recovery Design
4.1 Multi-AZ Deployment and Traffic Scheduling
Inference services should be deployed across multiple availability zones. The front end distributes traffic through a load balancer and regularly performs health checks on backend nodes. When a single availability zone fails, traffic should be switched to other zones within seconds. During deployment, each zone must retain sufficient spare capacity; otherwise, the switch will cause secondary overload.
4.2 Multi-Backend Routing and Circuit Breaking
When the system connects to multiple inference backends, or when multiple instance groups exist for the same model, the gateway should select routing targets based on health status. The following example shows the basic logic of a circuit breaker and fallback routing:
import timeclass CircuitBreaker:"""Simple circuit breaker: pause requests after consecutive failures exceed the threshold, allow probing after timeout."""def __init__(self, failure_threshold=5, reset_timeout=30):self.failure_threshold = failure_thresholdself.reset_timeout = reset_timeoutself.failures = 0self.opened_at = Nonedef allow(self):if self.opened_at is None:return True# After the circuit opens, allow one probe request once the reset time has passed (half-open state)return time.time() - self.opened_at >= self.reset_timeoutdef record_success(self):self.failures = 0self.opened_at = Nonedef record_failure(self):self.failures += 1if self.failures >= self.failure_threshold:self.opened_at = time.time()def route_request(prompt, backends):"""Try backends in order, skip nodes with open circuits, and raise when all are unavailable for upper-layer degradation."""for name, call, breaker in backends:if not breaker.allow():continuetry:result = call(prompt)breaker.record_success()return name, resultexcept Exception:breaker.record_failure()raise RuntimeError("All inference backends are unavailable; trigger the degradation flow")
This implementation only expresses the general idea. In production, concurrency safety, shared storage for circuit-breaker state, and differentiated handling of error types also need to be considered.
4.3 Async Tasks and Checkpoint Resume
Tasks such as long-text parsing and batch code generation are not suitable for relying on a single long connection. A more reliable approach is:
- Submit tasks to a message queue and have worker processes execute them asynchronously.
- Persist intermediate results at a fixed granularity, for example after every few paragraphs are completed.
- After a task is interrupted, resume from the latest checkpoint rather than starting from the beginning.
In this way, even if the inference service is temporarily unavailable, the task only waits in the queue and does not lose completed parts.
4.4 Request Result Caching
For highly deterministic requests, such as format conversion with a fixed template, the input can be hashed and the result cached, and cached content can be returned when the backend fails. The cache needs a reasonable expiration time, and it should clearly indicate that the result may not be newly generated.
5. Client Retries and Idempotency Design
The client is the last link in the availability chain, and an incorrect retry strategy can amplify failures. Common problems include retrying continuously without an interval, which floods the backend during recovery, or resubmitting the same message during retries, which causes duplicate session content.
The following principles are recommended:
- Exponential backoff with random jitter: Avoid a large number of clients retrying at the same moment.
- Retry only retryable errors: Timeouts, gateway errors, and overload-type errors can be retried; parameter errors and authentication failures should fail directly.
- Set an idempotency key: Generate a unique identifier for each message, and the server deduplicates based on it so that retries do not produce duplicate messages.
import randomimport timeimport requestsRETRYABLE_STATUS = {429, 500, 502, 503, 504}def post_with_backoff(url, payload, headers, max_retries=4, base_delay=0.5):for attempt in range(max_retries + 1):try:resp = requests.post(url, json=payload, headers=headers, timeout=30)if resp.status_code < 400:return resp.json()if resp.status_code not in RETRYABLE_STATUS:resp.raise_for_status() # Raise non-retryable errors directlyexcept requests.RequestException:if attempt == max_retries:raiseif attempt == max_retries:raise RuntimeError("Retry attempts exhausted")# Exponential backoff with random jitterdelay = base_delay * (2 ** attempt) + random.uniform(0, 0.3)time.sleep(delay)
The idempotency key can be passed in a request header, such as Idempotency-Key, and the server records it within a certain time window and rejects duplicate processing.
6. Degradation Strategies and User Experience
Between fully unavailable and fully available, there are many intermediate states that can be degraded. Degradation design should be planned in advance rather than decided temporarily after a failure occurs.
- Feature tiering: Separate core capabilities such as text Q&A from enhanced capabilities such as long-document processing and multimodal analysis, and prioritize core capabilities.
- Read-only mode: Historical sessions and already-generated content remain viewable, while new requests are temporarily queued or prompted to retry later.
- Drafts and local caching: The client automatically saves input before sending, so users can resend with one click after a failure and do not need to re-enter content.
- Clear status prompts: Show users service status, expected recovery approach, and alternative actions to reduce additional pressure caused by repeated refreshes.
For multi-client synchronization scenarios, conflict rules also need to be defined. For example, when the same session sends messages from both the web client and the mobile client at the same time, the server should determine the order by session version number or timestamp and merge the display on the client to avoid message disorder or loss.
7. Capacity Planning and Release Management
Disaster recovery capability is based on sufficient capacity. Capacity planning should focus on the following points:
- Peak-to-average ratio: Calculate the ratio of daily traffic peak to average, and reserve margin based on the worst case.
- Tiered rate limiting: Set quotas by tenant, API, and priority to protect core business during overload. For example, the critical task channel of enterprise customers can be prioritized, but this must be executed based on clear business rules.
- Canary release: First expose a new version to a small proportion of traffic, observe error rate and latency, and then gradually expand the scope.
- Release window: Avoid large-scale changes during business peaks and retain the ability to roll back quickly.
Capacity expansion can be implemented with general cloud infrastructure capabilities, such as autoscaling on container platforms, peak shaving and valley filling with message queues, data persistence in object storage, and a combination of logging services and monitoring alerts. On platforms such as Baidu AI Cloud, these general categories can be used to build the architecture described above; refer to the platform’s actual documentation for configuration details.
8. Monitoring, Alerting, and Failure Drills
The goal of monitoring is to detect anomalies before users perceive them at scale. Recommendations:
- Set multi-window alerts for success rate, latency, and rate-limit hit rate, for example observing 1-minute and 15-minute data at the same time to balance sensitivity and false-positive rate.
- Bind alerts to the on-call process and clarify response levels and escalation paths.
- Provide an external status page, publish an initial statement as soon as possible after a failure occurs, and add a postmortem after confirming the root cause.
- Conduct failure drills regularly, such as simulating a single-node outage, network partition, or rate limiting on one backend, to verify whether circuit breaking, switching, and degradation logic take effect as expected.
After a failure ends, the postmortem document should include the timeline, impact scope, root cause analysis, remediation measures, and follow-up improvement items. The focus of the postmortem is to improve the system and process, not to assign personal blame.
9. Implementation Checklist
- Define availability goals and monitor metrics by tier
- Deploy inference services across availability zones and complete switch drills
- Configure health checks and circuit-breaking policies for backends
- Use queues and checkpoints for long tasks to support checkpoint resume
- Implement exponential backoff, jitter, and idempotency keys on the client
- Develop feature tiering and degradation plans
- Use canary releases and retain rollback plans
- Establish alerting, on-call, and status page processes
- Conduct regular drills and produce traceable postmortem records
