High Availability
Keep AI services working when components fail.
High Availability
Imagine a customer-support chatbot that becomes unavailable every few hours, or a recommendation service that fails during a major sale. Even when the AI model is accurate, repeated interruptions damage user trust and can stop important business workflows.
High Availability, often abbreviated as HA, is the architectural discipline of keeping a service usable despite expected component failures. It treats failure as normal and plans detection, isolation, recovery, and degraded operation before incidents occur.
What Is High Availability?
High availability is the ability of a system to meet a defined availability objective over time even when some hardware, software, networks, zones, dependencies, or releases fail.
- Avoid unacceptable single points of failure
- Detect unhealthy components quickly and accurately
- Route work to healthy capacity or an approved fallback
- Protect important state from loss or corruption
- Preserve a useful experience when full functionality is unavailable
- Restore normal operation within an agreed recovery time
High availability does not mean zero downtime. It defines a measurable target and applies controls whose cost and complexity are justified by business impact.
Availability Objectives
| Concept | Meaning |
|---|---|
| Service Level Indicator (SLI) | A measured signal such as successful eligible requests or workflow completion |
| Service Level Objective (SLO) | The target level for an SLI over a defined period |
| Service Level Agreement (SLA) | A formal commitment that may include business consequences |
| Error budget | The amount of unreliability permitted by the objective |
| Recovery Time Objective (RTO) | Maximum acceptable time to restore a service or process |
| Recovery Point Objective (RPO) | Maximum acceptable amount of recent data loss |
Availability = successful eligible requests / total eligible requests x 100
99.9% monthly availability permits roughly 43 minutes of unavailability
before exclusions and measurement details are applied.Define what counts as successful. A chatbot returning an error page is unavailable, but a chatbot returning fast, empty, or unusable answers may also fail the real user objective even if its HTTP status is successful.
High Availability, Fault Tolerance, and Disaster Recovery
| Discipline | Primary Goal |
|---|---|
| High availability | Minimize service interruption during ordinary failures |
| Fault tolerance | Continue operating with little or no interruption after selected faults |
| Resilience | Absorb, adapt to, and recover from failures and changing conditions |
| Disaster recovery | Restore systems and data after a severe site, region, security, or operational event |
| Backup | Create a recoverable copy of important data or configuration |
Backups alone do not provide availability, and redundant servers do not replace disaster recovery. These controls solve different failure scenarios and must be designed together.
Failure Domains and Single Points of Failure
A failure domain is a group of resources that can fail together, such as one process, host, rack, availability zone, cloud region, identity provider, model provider, or shared database. Redundancy is useful only when replicas do not share the same critical failure domain.
- Map every required request-path dependency.
- Identify shared databases, credentials, networks, quotas, and control planes.
- Check whether replicas use independent zones and capacity pools.
- Include DNS, identity, secrets, observability, deployment, and third-party services.
- Decide which dependencies require redundancy, fallback, or graceful degradation.
Core High-Availability Components
Redundant Service Instances
Run enough application and model-serving instances across appropriate failure domains so planned maintenance or one failure does not remove all capacity. Stateless services are usually easier to replace and rebalance.
Load Balancing and Traffic Management
Load balancers distribute traffic among healthy instances and remove failed ones. Global routing can direct users between regions or providers when business requirements justify the added complexity.
Health Checks
Liveness checks determine whether a process should restart; readiness checks determine whether it can receive traffic. Deeper synthetic checks can verify critical workflows without making basic health dependent on every optional service.
Reliable Data Services
Databases, object stores, indexes, queues, and caches need replication, durability, backups, and restore procedures suited to their importance. Define consistency and failover behavior so a secondary does not serve corrupt or dangerously stale state.
Monitoring and Incident Response
Measure user-facing success, latency, saturation, errors, queue age, dependency health, model availability, and data freshness. Alerts need clear owners, runbooks, escalation paths, and enough diagnostic context to act.
Reference Architecture
Users -> DNS/traffic manager -> Load balancer
|-> App replica in Zone A -> Model endpoint A
|-> App replica in Zone B -> Model endpoint B
|
Replicated database + durable queue
|
Metrics, logs, traces, alerts, and incident response
Optional dependency failure -> cache/fallback/degraded response/human handoffAI-Specific Availability Risks
| Dependency | Possible Failure | Availability Response |
|---|---|---|
| Model provider | Outage, quota, throttling, or model retirement | Timeout, circuit breaker, queued work, approved fallback |
| Self-hosted model | GPU failure, memory exhaustion, slow loading | Replicas, warm capacity, smaller fallback, admission control |
| RAG index | Search failure or stale index | Keyword fallback, cached approved content, clear limitation |
| Document ingestion | Parser or embedding backlog | Durable queue, retries, freshness alert, old-version labeling |
| Agent tool | External API slow or unavailable | Skip optional step, retry safely, checkpoint, human escalation |
| Safety service | Policy check unavailable | Fail closed for high-risk output; use approved safe response |
| Context store | Conversation state unavailable | Stateless fallback or ask user to restore context |
Timeouts, Retries, and Circuit Breakers
Distributed systems must assume dependencies will sometimes be slow. Without deadlines, waiting requests consume connections, memory, and worker capacity until the failure spreads.
- Set an end-to-end deadline and give each dependency a smaller time budget.
- Retry only transient errors and only when the operation is safe or idempotent.
- Use exponential backoff and jitter to avoid synchronized retry storms.
- Limit retry attempts so they do not exceed the user's deadline.
- Open a circuit breaker when repeated failures show a dependency is unhealthy.
- Apply bulkheads so one overloaded dependency or tenant cannot consume all capacity.
Request deadline: 8 seconds
Retrieval budget: 1 second
Model budget: 5 seconds
Output controls: 1 second
Response reserve: 1 second
A retry is allowed only when remaining time and operation safety permit it.Graceful Degradation
When full functionality cannot be preserved, offer a smaller but honest experience instead of a complete outage or misleading answer.
- Use a smaller approved model for suitable requests.
- Return cached, permission-safe information with visible freshness.
- Disable optional personalization or enrichment.
- Queue long tasks and notify users when results are ready.
- Provide deterministic search or FAQ results when generation is unavailable.
- Offer human support or manual continuation for important workflows.
- State the limitation clearly rather than fabricating a result.
Data Availability and Consistency
Application replicas can fail over quickly, but stateful systems require deliberate consistency and recovery decisions. Replication delay, conflicting writes, corrupted data, and stale permissions can make an apparently available system unsafe.
- Define which writes need strong consistency and which reads may tolerate delay.
- Use idempotency keys to prevent duplicate actions during retries or failover.
- Back up databases, model registries, prompts, configuration, and critical metadata.
- Protect backups from the same credentials and failure domains as primary data.
- Test restoration and verify application behavior after recovery.
- Document how vector indexes, caches, and derived stores are rebuilt from sources.
Active-Active and Active-Passive
| Pattern | How It Works | Trade-Off |
|---|---|---|
| Active-active | Multiple sites or instances serve traffic concurrently | Fast failover but harder data consistency and operations |
| Active-passive | Standby takes over when primary fails | Simpler coordination but slower recovery and idle capacity |
| Pilot light | Critical data and minimal services remain ready | Lower cost but significant scale-up time |
| Backup and restore | Environment is rebuilt after disaster | Lowest standing cost and longest recovery |
Choose a pattern from RTO, RPO, data consistency, traffic, operational maturity, and business impact—not from the desire to use the most advanced design.
Safe Deployments
Software, model, prompt, configuration, data schema, and infrastructure changes are major sources of downtime. Availability architecture therefore includes controlled release and rollback.
- Use immutable, versioned artifacts and compatible data contracts.
- Deploy gradually with rolling, blue-green, or canary strategies.
- Check readiness before sending traffic to new instances.
- Monitor service, model-quality, safety, and business signals during rollout.
- Stop or roll back automatically when approved thresholds fail.
- Keep database changes backward compatible across mixed versions.
High-Availability Design Process
1. Determine Business Impact
Identify critical users and workflows, acceptable interruption, financial or safety consequences, support hours, and dependencies. Not every feature needs the same objective.
2. Define SLO, RTO, and RPO
Turn business expectations into measurable availability and recovery targets, including what qualifies as success and which maintenance or dependency conditions are included.
3. Map Dependencies and Failure Domains
Trace every critical path through identity, DNS, network, application, model, data, tools, safety checks, and external providers. Identify correlated failures and single points of failure.
4. Select Controls and Degraded Modes
Apply redundancy, timeouts, retries, failover, queues, durable state, backups, fallback, and human continuation according to impact and cost.
5. Observe and Operate
Instrument user-facing objectives and dependencies, assign alert ownership, prepare runbooks and communication, and maintain capacity for failures and maintenance.
6. Test Failure and Recovery
Exercise instance, zone, provider, database, queue, network, credential, deployment, and restore failures. Record recovery time and close gaps revealed by evidence.
A Simple Analogy
A hospital emergency department does not depend on one doctor, one power source, or one communication channel. Staff coverage, backup power, triage, supplies, monitoring, escalation, and practiced emergency procedures work together so critical care continues.
Similarly, AI availability requires more than duplicate servers. The complete workflow, data, dependencies, people, and recovery process must remain capable of delivering a safe and useful outcome.
Python Example
This simplified example selects the first healthy endpoint and otherwise returns a controlled degraded response. Production clients also need deadlines, circuit breakers, authenticated calls, telemetry, compatibility checks, and carefully tested fallback behavior.
endpoints = [
{"name": "primary", "healthy": False},
{"name": "secondary", "healthy": True},
]
def choose_endpoint(candidates):
for endpoint in candidates:
if endpoint["healthy"]:
return endpoint["name"]
return None
selected = choose_endpoint(endpoints)
if selected:
print(f"Routing request to {selected}")
else:
print("AI service is temporarily unavailable; offer human support")Testing High Availability
| Test | Evidence Sought |
|---|---|
| Replica termination | Traffic moves to healthy capacity within the objective |
| Dependency latency | Timeouts and circuit breakers prevent cascading failure |
| Zone outage | Independent replicas and data remain available |
| Provider outage | Fallback or degraded behavior is safe and useful |
| Database failover | Writes remain correct and duplicates are prevented |
| Backup restore | Data and services recover within RTO and RPO |
| Bad deployment | Canary detection and rollback limit user impact |
| Capacity loss | Remaining resources handle priority traffic without collapse |
Common Challenges
- Hidden shared dependencies that defeat apparent redundancy
- Data consistency and duplicate actions during failover
- Health checks that are too shallow, too sensitive, or dependency-coupled
- Retry storms and cascading resource exhaustion
- Limited GPU, cloud-region, or model-provider capacity
- Fallback models with incompatible quality, safety, or output behavior
- Backups that exist but cannot be restored within objectives
- Alert fatigue, unclear ownership, and incomplete runbooks
- Cost and operational complexity exceeding the business value of the target
Best Practices
- Define availability from critical user workflows and measurable SLOs.
- Set RTO and RPO from business impact and data-loss tolerance.
- Map complete dependencies and correlated failure domains before adding replicas.
- Use independent healthy instances, appropriate load balancing, and capacity headroom.
- Apply deadlines, safe bounded retries, jitter, circuit breakers, and bulkheads.
- Design honest graceful degradation and human continuation for dependency failures.
- Protect state with idempotency, replication, backups, and regularly tested restoration.
- Release application, model, prompt, data, and infrastructure changes gradually with rollback.
- Alert on user-facing symptoms and actionable causes with clear owners and runbooks.
- Run failure and recovery exercises and compare measured results with the objectives.