Printing and PDF export are disabled for this content. View it online at Full Stack Learning Simplified.
System Design Availability and Reliabilityπ± Beginner
Availability is the percentage of time a system is up and responding; reliability is doing the *right* thing correctly. A system can be available (responding) but unreliable (returning wrong results).
The βninesβ
| Availability | Downtime / year |
|---|---|
| 99% (βtwo ninesβ) | ~3.65 days |
| 99.9% (βthree ninesβ) | ~8.8 hours |
| 99.99% (βfour ninesβ) | ~52 minutes |
| 99.999% (βfive ninesβ) | ~5 minutes |
Each extra nine is dramatically harder and more expensive. availability = uptime / (uptime + downtime).
SLA, SLO, SLI
| Term | Is |
|---|---|
| SLI | the measured indicator (actual uptime %) |
| SLO | your internal target (e.g. 99.95%) |
| SLA | the contractual promise to customers (with penalties) |
Achieving high availability
- Remove single points of failure β redundancy at every layer (servers, databases, zones).
- Replication & failover β a standby takes over automatically when a component dies.
- Multiple availability zones / regions β survive a whole datacenter outage.
- Health checks + load balancers β route away from unhealthy instances.
Redundancy math
Components in series multiply failure risk; redundant components in parallel multiply availability. Two independent 99% components in parallel give ~99.99% β which is why redundancy is the foundation of HA.
Warning: More nines cost real money and complexity. Don't chase five nines for an internal tool β set an SLO that fits the business, and spend the redundancy budget where downtime actually hurts.
Tip: The single biggest lever for availability is eliminating single points of failure through redundancy and automatic failover. Define an SLO first, then design the minimum redundancy that meets it β availability is bought, not free.
Implementing a Circuit Breaker for High Availability
A circuit breaker prevents cascading failures by stopping requests to a struggling dependency:
circuitBreaker.ts
class CircuitBreaker {
private failures = 0;
private state: "CLOSED" | "OPEN" | "HALF_OPEN" = "CLOSED";
private nextAttempt = 0;
constructor(
private failureThreshold = 5,
private resetTimeoutMs = 10000
) {}
async execute<T>(fn: () => Promise<T>): Promise<T> {
if (this.state === "OPEN") {
if (Date.now() > this.nextAttempt) {
this.state = "HALF_OPEN"; // Test if service recovered
} else {
throw new Error("Circuit is OPEN: Request blocked to prevent cascade failure");
}
}
try {
const result = await fn();
this.onSuccess();
return result;
} catch (err) {
this.onFailure();
throw err;
}
}
private onSuccess() {
this.failures = 0;
this.state = "CLOSED";
}
private onFailure() {
this.failures++;
if (this.failures >= this.failureThreshold) {
this.state = "OPEN";
this.nextAttempt = Date.now() + this.resetTimeoutMs;
}
}
}System Design Architecture Takeaway: System design balances scalability, availability, performance, consistency, and cost across distributed systems.
Free preview. Sign in and subscribe to unlock all 982 lessons across 31 courses.
Free preview Β· Β© 2026 Full Stack Learning Simplified