High Availability Architecture Design: Lessons from Large-Scale Flight Cancellations

    This article uses large-scale flight cancellations as a lens to explain how to design high availability (HA) systems that behave predictably when partial dependencies fail. It covers business tiering and dependency mapping, consistency strategies for inventory and seat reservation, idempotent writes for check-in, tiered degradation switches and traffic governance, a minimal observability metric set, capacity redundancy and recovery procedures, and routine fault injection drills. The same patterns can be implemented on general-purpose cloud infrastructure using common capabilities such as object storage, message queues, container platforms, log services, and monitoring and alerting—without relying on any proprietary interfaces.

    When an external environment is disrupted and a large number of flights are canceled, the visible problem looks like a scheduling issue. The underlying problem is behavioral: how the system is designed to act when some dependencies are unavailable. Using this scenario as a reference, this article breaks down how to model a high availability architecture. It starts with business tiering and dependency mapping, then uses two core flows—seat inventory and check-in—to illustrate consistency strategies and degradation switches. It then provides a fault injection drill script and an observability metrics checklist, and closes with capacity redundancy and recovery procedures. The goal is to turn “uncontrollable external events” into “predictable system behavior.” All of the approaches described here can be implemented on general-purpose cloud infrastructure using common capabilities such as object storage, message queues, container platforms, log services, and monitoring and alerting, including on Baidu AI Cloud following the same pattern, with no dependency on any proprietary APIs.

    1. Translating a Service Outage into Technical Terms

    External events are uncontrollable; the system’s response to them is not. The first step is to build an “outage → impact → countermeasure” mapping table. Outages show up as dependency timeouts, data delays, and a rising share of manual workarounds. Impact is measured by core flow success rate, end-to-end latency, and backlog volume. Countermeasures fall into five categories: rate limiting, degradation, queuing, asynchronous processing, and manual takeover. Only when these three dimensions are aligned can subsequent architecture decisions be grounded in evidence.

    2. Business Tiering and Dependency Mapping

    Classify all capabilities into three tiers. Tier 1 covers core flows that cannot be replaced, such as order creation, inventory deduction, and identity verification. Tier 2 covers capabilities that can be degraded briefly, such as recommendations, loyalty points, and marketing calculations. Tier 3 covers capabilities that can be shut down completely, such as non-critical reports and background batch jobs.

    Next, draw a dependency map for each Tier 1 capability, marking whether each dependency is synchronous or asynchronous, strongly consistent or eventually consistent, and whether an alternative data source exists. Once the maps are complete, the degradation order becomes obvious: shut down Tier 3 first, degrade Tier 2 next, and touch Tier 1 only as a last resort.

    3. Core Flow One: Concurrent Consistency for Inventory and Seats

    The essence of inventory problems is “no overselling under concurrency.” A common approach has three layers. At the database layer, row locks or optimistic locks protect individual records. At the cache layer, atomic decrement and reservation tokens reduce reads back to the source. At the business layer, a two-phase “reserve → confirm → release” semantic handles timeouts. Example code:

    1. def reserve(seat_id, user_id, ttl=900):
    2. token = atomic_decr(seat_id) # Atomic cache decrement
    3. if token < 0:
    4. atomic_incr(seat_id)
    5. return "SOLD_OUT"
    6. put_hash(f"reserve:{token}", {"uid": user_id}, ttl)
    7. return token
    8. def confirm(token):
    9. if not exists(f"reserve:{token}"):
    10. return "EXPIRED"
    11. db.execute("UPDATE orders SET status='CONFIRMED' WHERE token=?", token)
    12. del_key(f"reserve:{token}")
    13. def release(token):
    14. seat_id = get_hash(f"reserve:{token}", "sid")
    15. atomic_incr(seat_id)
    16. del_key(f"reserve:{token}")

    The key points: reservations must carry an expiration time; confirm and release must be idempotent; and the cache and database are kept consistent by updating the cache first and persisting to the database second, with compensation on failure to control the inconsistency window.

    4. Core Flow Two: Idempotent Writes for Check-In and Credentials

    Check-in operations are frequently resubmitted, so they must be converged with an idempotency key. The recommended combination is a “business unique key + state machine + unique index”:

    1. CREATE TABLE checkin (
    2. id BIGINT PRIMARY KEY,
    3. biz_key VARCHAR(64) NOT NULL,
    4. state VARCHAR(16) NOT NULL,
    5. updated_at TIMESTAMP,
    6. UNIQUE KEY uk_biz (biz_key)
    7. );

    The state machine allows only one-way transitions of 0→1→2. Any duplicate request that hits the unique index returns the existing result directly, avoiding a second deduction and duplicate ticket issuance. When an external outage forces manual takeover, manual operations carry the same biz_key into the same table, so the automated and manual paths share a single source of truth.

    5. Degradation Switches and Traffic Governance

    Degradation is not about turning features off; it is about switching semantics. Model each switch as an object in the configuration center with three properties: tiered, gradual rollout capable, and rollback capable. Pair this with a local cache fallback so the configuration center itself does not become a single point of failure:

    1. degrade:
    2. level: L2 # L0 normal / L1 rate limit / L2 degrade / L3 off
    3. rules:
    4. - path: /recommend
    5. action: return_cache
    6. max_age: 600
    7. - path: /report
    8. action: reject
    9. gray: 0.3
    10. fallback_local: true

    On the traffic governance side, the gateway layer applies ingress rate limiting and priority queues, the service layer applies concurrency isolation (thread pools or semaphores), and the data layer applies write coalescing and batched persistence. Layering all three is what keeps Tier 1 flows alive when dependencies fluctuate.

    6. Observability: You Cannot Decide What You Cannot See

    The minimal viable metric set includes core flow success rate, P99 latency, dependency timeout rate, queue backlog depth, number of degradation triggers, and manual takeover volume. Logs must carry a unified trace_id that spans from the gateway to storage. Alerts must distinguish “symptom alerts” (success rate dropping) from “root cause alerts” (a specific dependency timing out) to avoid alert storms. Example PromQL-style expressions:

    1. sum(rate(core_success_total[5m])) / sum(rate(core_total[5m])) < 0.98
    2. histogram_quantile(0.99, rate(core_latency_bucket[5m])) > 800

    7. Capacity Redundancy and Recovery Procedures

    Size redundancy for “the degraded traffic it must absorb,” not for full peak volume.固化 the recovery procedure into four steps: confirm the external dependency has recovered, close degradation level by level (L3→L0), backfill the backlog (consume asynchronous tasks at a limited rate), and review and update the drill scripts. Rate limiting during backfill is essential to prevent a secondary avalanche at the moment of recovery.

    8. Routine Fault Injection Drills

    Drills should cover three fault types: dependency timeouts, dependencies returning dirty data, and dependencies being completely unavailable. Example drill script:

    1. inject --target dependency --mode latency --delay 3000ms --ratio 0.5
    2. inject --target dependency --mode error --code 503 --ratio 0.2
    3. verify --check core_success_rate --threshold 0.98
    4. rollback --all

    The output of a drill is not “pass/fail.” It is updated degradation thresholds, additional fallback data, and corrected alert rules.

    Conclusion

    Turning uncontrollable external outages into controllable system behavior is the central proposition of high availability architecture. All of the methods above can be implemented on general-purpose cloud infrastructure using common capabilities such as object storage, message queues, container platforms, log services, and monitoring and alerting. For example, the same pattern can be applied on Baidu AI Cloud to complete the full loop of tiering, degradation, idempotency, and observability without relying on any proprietary interfaces.