Building a Highly Available Ad Delivery System: A Business Continuity Perspective
High availability is not just about keeping servers online—it is about preserving business continuity under failure. This article explores how to design a highly available ad delivery system by defining measurable availability goals, mapping business-critical paths, identifying failure boundaries, and applying redundancy, isolation, idempotency, and recovery practices. It covers timeout and retry strategies, asynchronous processing pitfalls, data recovery objectives, capacity planning, and how to make high availability a sustainable engineering process rather than a one-time effort.
1. Rethinking Availability from a Business Perspective
When discussing system architecture, high performance, high availability, and easy scalability are often mentioned together, but they address fundamentally different problems.
High performance is about how fast a system processes requests under given resources and how much load it can handle. High availability is about whether the business can continue delivering acceptable service when failures or resource shortages occur. Scalability is about whether the system can add capacity or evolve its architecture at a controllable cost as the business grows.
The three influence one another but cannot substitute for each other. A system that responds quickly under normal conditions can become entirely unavailable due to a single database failure. A system deployed across multiple service replicas can still go down completely if a shared dependency fails. Therefore, the starting point of high availability design is not adding more machines, but answering a more fundamental question: under what conditions do users still consider the business usable?
Take a general-purpose ad delivery system as an example. The business may include delivery configuration, task scheduling, budget control, performance analytics, and generative AI-assisted creative production. Availability requirements typically vary significantly across these functions:
- Task submission must clearly return success, failure, or in-progress status—users must never be left uncertain about whether a task took effect.
- Budget deduction must preserve business constraints; service continuity should never come at the cost of duplicate deductions or exceeding budgets.
- Performance reports can be updated with a bounded delay acceptable to the business, but they must display the data refresh time.
- Creative generation can be placed in a waiting queue and must not block the core delivery flow simply because generation takes a long time.
This shows that availability is not a single “online status,” but a service capability jointly defined by correctness, timeliness, and business integrity.
2. Establishing Measurable Availability Goals
1. Distinguish Time-Based Availability from Request-Based Availability
Time-based availability is usually expressed as:
Availability = Available Time ÷ Total Observation Time
This metric suits measuring clear, complete service outages, but it struggles to describe partial failures. For example, if only some users cannot submit tasks, or some requests suffer severe timeouts, the service has not fully stopped—yet the business is already affected.
Request-based availability is usually expressed as:
Request Availability = Requests Meeting Service Requirements ÷ Total Valid Requests Counted
Here, “meeting service requirements” should not be judged solely by the returned status code; it should also incorporate business outcomes and latency requirements. A response that returns success but where the task was not persisted, key fields are wrong, or the response exceeded the agreed time limit may still need to be counted as a failure.
For asynchronous flows, additional metrics such as completion rate, completion latency, and backlog size should be tracked. An entry point that keeps returning “accepted” does not mean the background processing pipeline is healthy.
2. Define Statistical Boundaries
Before setting service targets, you must agree on:
- Which business operations count as core services;
- Which errors are the system’s responsibility versus user input issues;
- The length of the statistical window;
- Whether to track different user groups, regions, and entry points separately;
- How planned maintenance is recorded, and whether it counts toward the target.
Without clear boundaries, metrics can easily become numbers that “look good.” For example, measuring only the entry service’s responses while ignoring downstream execution failures overstates true availability.
3. Manage Risk with Error Budgets
An error budget can be understood as the amount of substandard service allowed within a given service target and statistical window.
Its value is not to justify failures, but to help teams balance feature iteration against stability investment. When the error budget is being consumed too quickly, the priority should be addressing hidden failure risks and reducing high-risk changes—not expanding release volume.
Targets should also reflect business cost. Stricter availability requirements typically mean higher costs in redundancy, operations, and data consistency. The sensible approach is tiering by business criticality rather than imposing the same standard on every feature.
3. Map the Business Flow First, Then Identify Failure Boundaries
An ad delivery system can be abstracted into the following structure:
User request
→ Access and identity verification
→ Delivery configuration and task management
→ Budget validation and critical state storage
→ Asynchronous task dispatch
→ Delivery execution and result recording
Performance analytics and creative generation can run as relatively independent pipelines, avoiding becoming synchronous dependencies of the core request path.
This is only a generic structure for analysis, not a fixed implementation of any real system. When designing, you should build a dependency graph based on your actual business and examine failure propagation paths one by one.
1. Don’t Only Check Service Instances
Common single points of failure include not just application services but also:
- The only node allowed to write data;
- A single configuration distribution entry point;
- An identity verification service that must be called synchronously;
- A centralized task scheduling component;
- Storage or network paths shared by all instances;
- Shared configuration updated simultaneously across instances during deployment.
Multiple application replicas that share a single failure point can only tolerate partial instance failures—they cannot guarantee the whole business flow remains available.
2. Watch for Common-Mode Failures
Redundant instances should be distributed across different failure domains as much as possible. A failure domain can be a process, host, rack, or independently deployed region; the specific boundary depends on your actual infrastructure.
But physical distribution cannot eliminate all common-mode failures. Misconfigurations, defective releases, and bad data can still affect multiple replicas simultaneously. Therefore, infrastructure redundancy must be combined with staged rollouts, configuration validation, and rollback capability.
4. Use Redundancy and Isolation to Limit Blast Radius
1. Prefer Horizontal Scaling for Stateless Services
Services suitable for statelessness should avoid keeping critical task state only in local memory. Requests should be processable by any healthy instance, and business state already acknowledged should survive instance shutdown.
The access layer needs to cooperate with health checks and traffic removal. Health checks should not merely confirm that the process is alive—they should moderately verify whether an instance can actually handle requests. But checks should not be too heavy either; otherwise, a brief fluctuation in a dependency could cause many instances to be removed at once, amplifying the failure.
2. Isolate by Resource and Business
Long-running creative generation, large-scale report computation, and delivery task submission should not compete for the same limited worker threads, connections, and execution resources.
You can set up separate task queues, concurrency quotas, and resource pools so that backlogs in non-core tasks do not drag down core operations. For shared resources, business-level quotas should also be enforced to prevent a single large task or single user from consuming all system capacity.
Isolation does not mean completely splitting apart every component—it means aligning the blast radius of failures with business priority.
5. Handle Timeouts, Retries, and Circuit Breaking Carefully
1. Timeouts Should Follow an Overall Time Budget
When a request passes through multiple dependencies, each with a long timeout, the total elapsed time may far exceed what users can tolerate.
A better approach is to set a time budget for the complete request and allocate portions of it to each stage. Downstream processing should be aware of the remaining time, avoiding continued resource consumption after the upstream has already given up.
2. Retries Must Have Boundaries
Retrying suits certain transient failures, but not all failures deserve retries. Parameter errors, insufficient permissions, and explicit business rejections generally should not be retried.
For retryable failures, limit the retry count, apply backoff with jitter, and control the total retry traffic. Otherwise, an overloaded system will generate even more requests, creating a “failure—retry—worse failure” loop.
For write operations, idempotency must be solved before retrying. A call timeout only means the caller did not receive a result in time—it does not mean the server did not complete the operation.
3. Circuit Breaking and Degradation Need Business Semantics
When a dependency is continuously failing, circuit breaking can temporarily stop calls to protect local resources. During recovery, a small number of requests should be let through gradually to verify whether the dependency has truly recovered.
Degradation requires clarity about what can be sacrificed. For example, performance reports can return historical results with a data-refresh timestamp; creative generation can pause accepting new tasks or defer processing. Operations involving budgets, permissions, and critical state should never fake success to maintain superficial availability.
6. Critical Write Operations Must Preserve Correctness
In a delivery system, budget deductions, task creation, and state transitions are far more sensitive than ordinary queries. These operations cannot simply rely on “retry after failure.”
1. Build an Idempotency Mechanism
A logical operation should carry a stable business request identifier. The server associates this identifier with the processing result, so duplicate requests can return the existing result instead of executing again.
The flow looks like this:
- Validate request parameters and business permissions.
- Check the request identifier within a transaction or an equivalent atomic mechanism.
- If a processing record already exists, return the recorded status or result.
- If not, perform the state change and save the processing record.
- Confirm to the caller only after a successful commit.
Concurrent requests may both pass a plain lookup check, so a uniqueness constraint or another reliable concurrency control mechanism is also required. There must be a clear atomicity boundary between the request identifier, the business change, and the result record.
2. Avoid Blind Degradation for Strongly Constrained Data
Critical data such as budget balances and permission decisions requires an explicit consistency strategy. You must not use a potentially stale cache to approve sensitive operations just because the primary data service is unavailable.
When the system cannot confirm critical constraints, rejecting, queuing, or pausing related operations may serve the business better than continuing to accept requests. High availability does not mean allowing writes under all circumstances—it means maintaining explainable, recoverable behavior that does not violate business rules even during failures.
7. Use Asynchronous Decoupling, But Don’t Just Relocate the Problem
Message queues can buffer traffic spikes and decouple task submission from task execution, but they do not automatically solve duplicate processing, backlog, and data loss problems.
1. Distinguish Acceptance from Completion
Asynchronous interfaces should clearly separate “task reliably accepted” from “task executed and completed.” If the task has not been persisted, it should not be reported as reliably accepted.
For the flow of “write the task record, then send the message,” you must guard against the case where the database commit succeeds but the message send fails. A common approach is to save the pending event in the same transaction as the business record, then deliver it via an independent process, using retries and reconciliation to compensate for missed messages.
2. Design Consumers for Possible Duplicate Delivery
Consumers should check processing status by task identifier to prevent the same task from double-charging or repeating irreversible operations. On failure, they must distinguish retryable errors from exceptions requiring manual intervention.
Persistently failing tasks should enter a quarantine flow rather than blocking normal tasks indefinitely.
3. Monitor Backlog Age, Not Just Count
Queue length only tells part of the story. More business-meaningful metrics include the wait time of the oldest task, task completion latency, consumption rate, and failure ratio.
If a task eventually completes but has already missed its business deadline, it still counts as an availability problem.
8. Data Redundancy Cannot Replace Recovery Capability
Data replicas, failover, and backups each solve different problems. Replicas reduce outages caused by some node failures, but erroneous deletions or writes may be replicated to multiple copies. Backups provide a historical recovery point, but do not guarantee instant recovery.
Therefore, data protection should define two objectives:
- Recovery Point Objective (RPO): the maximum amount of data loss allowed, measured in time.
- Recovery Time Objective (RTO): the maximum time allowed to restore the business after a failure.
Backup strategies, replication methods, and failover procedures should all be designed around these two objectives. In asynchronous replication environments, failover may leave a data gap, and you must clarify how to verify and compensate for it.
You must also prevent a split-brain situation where multiple nodes accept conflicting writes after failover. The failover mechanism should enforce clear control of primary write authority, rather than deciding based on a single health check result.
Most importantly, perform recovery drills regularly. The existence of backup files does not mean the business can be recovered; you must confirm that data is readable, applications can start, critical operations work, and recovery time meets targets.
9. Incorporate Performance and Scalability into Stability Design
A highly available system needs spare capacity to absorb failures. If normal operation already saturates resources, losing a portion of instances may immediately overload the remaining ones, triggering cascading failures.
Capacity planning should cover at least three states:
- Normal business peaks;
- Peaks after partial capacity has exited;
- The recovery phase, when real-time traffic and backlogged tasks arrive together.
Autoscaling is not instantaneous. Instance provisioning, data loading, and traffic switching all take time, so combine it with rate limiting, priority scheduling, and capacity headroom.
Scalability is also not just adding more instances. A system may be constrained by database hotspots, centralized scheduling, global locks, or a single shared resource. Use load testing to identify real bottlenecks, then choose partitioning, asynchronization, or reducing shared state—instead of blindly splitting services.
10. Make High Availability a Sustainable Engineering Process
1. Monitoring Must Cover Business Outcomes
Beyond CPU, memory, and network metrics, monitor task submission success rates, delivery execution latency, budget processing anomalies, report data freshness, and creative generation completion rates.
Infrastructure metrics help locate causes; business metrics help assess impact. Alerts should prioritize conditions where users are already affected—or are about to be.
2. Releases and Configuration Changes Must Be Controlled
Use small-scope validation, staged rollouts, and continuous observation to limit the impact of defective releases. Configuration changes should also support validation, auditing, and rollback.
Database schema changes especially require consideration of old and new versions coexisting. Code can be rolled back, but data changes cannot automatically roll back with it—so a compatible migration path must be designed in advance.
3. Drills Should Validate the Business, Not Just the Failover
Failure drills can cover instance shutdowns, dependency timeouts, queue backlogs, and data node anomalies, but you must first define the drill scope, stop conditions, and rollback plan.
Validation should not only check “did the service restart”—it should also verify whether accepted tasks were lost, whether critical operations were executed twice, whether bad data appeared, and whether the system can properly drain the backlog after recovery.
Conclusion
The core of a highly available architecture is translating business commitments into measurable, verifiable engineering mechanisms. Define service targets, identify critical paths, limit blast radius, protect data correctness, and continuously validate through capacity planning, controlled releases, and recovery drills—only then can you build trustworthy business continuity.
High performance determines efficiency under normal conditions, scalability determines room to grow, and high availability determines the business floor under failure. Only by designing all three together can an ad delivery system not merely run—but run stably through change, pressure, and failure.
