Post-Incident Review of Web and API Outages in Online AI Services: High Availability Best Practices

    This article analyzes a partial outage affecting both the web interface and API of an online AI conversational service. It walks through a reusable incident response and high availability methodology, covering impact boundary definition, layered fault diagnosis across the access, application, inference, dependency, and data layers, observability design, capacity elasticity and overload protection with pseudocode examples, change control and canary releases, API governance and status page communication, a postmortem template, and a prevention checklist. The goal is to help developers and enterprise users turn one-off outages into systematic reliability improvements.

    1. Incident Replay and Impact Boundaries: Define “Partial Outage” First

    An online conversational AI service once experienced a partial outage affecting both its web interface and API, lasting about 1 hour and 49 minutes before recovery. Such incidents typically share three characteristics: first, not all requests fail — only certain regions, endpoints, or features become unavailable; second, the web side shows chat interface errors while the API side returns timeouts, 5xx responses, or rate-limiting errors; third, even after recovery, secondary impacts must be watched, including queue backlogs, cold caches, and retry traffic surges.

    Therefore, the first step of incident management is to define the impact boundary: the list of affected endpoints, the proportion of affected users, the distribution of error codes, regional and ISP distribution, start and recovery times, and whether data consistency was affected. A vague “recovered” status without boundaries can mask long-tail problems. Incident records should consistently use status terms like “partial outage,” “degraded performance,” or “maintenance window” to avoid ambiguity in external communication.

    2. Fault Layering: Tracing the Technical Chain Behind “Server Busy”

    “Server busy” is a user-facing message, not a root cause. An online AI service can be investigated layer by layer:

    1. Access layer: check load balancers, certificates, DNS resolution, and API gateway rate-limiting policies;
    2. Application layer: check whether thread pools, connection pools, and queues in web and API services are saturated;
    3. Inference layer: check model service concurrency, queue wait times, timeout settings, and batching strategies;
    4. Dependency layer: check whether dependencies such as authentication, billing, logging, message queues, and caches are timing out;
    5. Data layer: check session storage, configuration centers, and database connections for instability;
    6. Release layer: check whether recent changes, configuration updates, or canary batches align with the incident timeline.

    Common root causes include insufficient capacity, amplified dependency timeouts, configuration errors, incomplete rollbacks, connection pool exhaustion, cache breakdown, misconfigured rate-limit thresholds, and inference queue backlogs. The specific root cause should be confirmed in the formal postmortem, but the diagnostic order should be fixed to avoid on-the-spot guesswork.

    3. Observability: Detect Failures Before Users Report Them

    Observability should cover four signal types: metrics, logs, traces, and events. On the metrics side, focus on request volume, error rate, P95/P99 latency, timeout rate, rate-limit hit rate, queue length, inference concurrency, and dependency error rate. On the logging side, retain request IDs and error codes. On the tracing side, connect the full path from web requests and API calls to the inference service. On the events side, record releases, configuration changes, and alerts.

    On cloud platforms such as Baidu AI Cloud, you can combine general capabilities like load balancing, container platforms, log services, and monitoring/alerting to build a layered observability system, though the specific selection should match your existing architecture. Alerting should be tiered: a sustained rise in user-visible error rates triggers a level-one alert; rising timeouts in a single dependency trigger a level-two alert; capacity approaching thresholds triggers an early warning. Every alert should include a dashboard link, a preliminary impact assessment, and the on-call owner to reduce time to diagnosis.

    4. Capacity Elasticity and Overload Protection: Turn “Busy” Into Controlled Degradation

    Capacity planning for an online AI service cannot rely on average QPS alone — it must account for peak concurrency, the share of long-running requests, the distribution of inference latency, and the retry amplification factor. Set upper bounds on concurrency, queue depth, and timeouts, and protect core paths first under overload. For example, the web side can degrade non-critical features, while the API side returns explicit 429 or 503 responses with retry guidance; set shorter timeouts for long requests to avoid threads being held for extended periods.

    A pseudocode example:

    1. function handle_chat_request(req):
    2. if circuit_breaker.is_open("inference_service"):
    3. return degrade_response("Request volume is currently high, please retry later", retry_after=30)
    4. if rate_limiter.reject(req.user_id):
    5. return http_response(429, "Too many requests")
    6. try:
    7. return inference_pool.execute(req, timeout=8s)
    8. except TimeoutError:
    9. metrics.increment("inference_timeout")
    10. return http_response(503, "Service busy, please retry later")

    Health check configuration should also avoid “false health”:

    1. health_check:
    2. endpoint: /healthz
    3. interval: 10s
    4. timeout: 2s
    5. unhealthy_threshold: 3
    6. success_threshold: 2

    Health checks should verify both process liveness and the availability of critical dependencies, but they must not remove entire batches of instances due to brief flapping of non-critical dependencies. Readiness and liveness semantics should be distinguished.

    5. Change Control and Canary Releases: Reducing Human-Induced Failures

    Most short outages are change-related. Releases should follow four principles: small-batch canary rollouts, rollback capability, observability, and the ability to pause. Configuration changes also require versioning, auditing, and dual review. During the canary phase, closely watch error rates, latency, queues, and dependency errors — automatically pause or roll back when thresholds are exceeded. High-risk changes such as database schema updates, rate-limit threshold adjustments, timeout parameter changes, and certificate renewals should avoid peak business hours and come with prepared rollback scripts.

    6. API Governance and Status Page Communication: Making Behavior Predictable

    On the API side, unify error codes, retry semantics, and idempotency strategies. Retryable errors should use exponential backoff with random jitter to prevent retry storms; non-retryable errors should be clearly indicated. The API gateway should support rate limiting by tenant, endpoint, and region so that no single tenant can exhaust global capacity.

    The status page should distinguish between “partial outage,” “degraded performance,” and “under maintenance,” and record the start time, recovery time, affected scope, and follow-up actions. External communication should follow the principle of “fast first response, stable update cadence, and cautious recovery confirmation.” Continue observing for a period after recovery before marking the service as fully normal.

    7. Postmortem Template and Action Items

    A postmortem should include: incident summary, impact scope, timeline, root cause, response process, effective actions, ineffective actions, improvement items, owners, and deadlines. Improvement items must be verifiable — for example, “adjust the inference service timeout from X to Y and complete load testing,” “add circuit breakers for critical dependencies,” “complete the API error code documentation,” or “integrate status page updates into the on-call workflow.” Avoid unverifiable items like “strengthen monitoring.”

    8. Prevention Checklist

    1. Core endpoints have the four essentials: timeout, retry, circuit breaking, and rate limiting;
    2. Critical dependencies are deployed in isolation to prevent a single point of failure from dragging down the whole system;
    3. Capacity baselines and load-testing benchmarks are established;
    4. Releases and configuration changes are fully audited;
    5. The status page is linked with alerting;
    6. Partial outage scenarios are rehearsed quarterly;
    7. Postmortem action items are tracked to closure.

    In summary, short web and API outages are not frightening in themselves — what is dangerous is the lack of layered diagnosis, overload protection, and verifiable postmortems. By closing the loop across observability, elastic capacity, change control, degradation and rate limiting, and transparent communication, the impact of similar incidents can be kept within acceptable bounds while continuously improving the availability of online AI services.