A system can be correct and still be bad: too slow, too often down, or only able to serve a few users at once. This lesson defines the vocabulary used to describe system quality: latency, throughput, percentiles, availability, reliability, SLA and SLO. Then it shows how redundancy and failover raise availability, and how to calculate the effect. Non-functional requirements in step 1 of the framework are written in exactly these terms.
Detailed Notes
What Is It?
Latency: the time between sending a request and getting the response, measured in milliseconds.
Throughput: how much work the system completes per second (requests, messages or megabytes). Latency is how fast one request is; throughput is how many you can finish at once. A highway can have fast cars (low latency) and few lanes (low throughput).
Percentile: a way to describe a spread of values. p50 (median) means half of requests are faster than this number. p99 means 99% are faster, so 1 in 100 is slower. p99.9 is the slowest 1 in 1,000.
Availability: the fraction of time the system is working and able to serve requests. 99.9% availability means 0.1% downtime.
Reliability: the system does what it should, correctly, even when parts fail, including not losing or corrupting data. A service can be available (answers quickly) but unreliable (answers wrongly).
Durability: once data is acknowledged as saved, it will not be lost.
SLA (service level agreement): a promise to customers, usually with money-back penalties if broken. SLO (service level objective): the internal target, set stricter than the SLA. SLI (service level indicator): the measured number, such as "fraction of requests under 200 ms".
Fault tolerance: continuing to work when a component fails.
Why Do We Need It?
Without numbers, "fast" and "reliable" mean nothing and cannot be designed for. Targets decide the architecture: 99.9% can be met with careful operations in one region; 99.99% needs redundancy in multiple zones and automatic failover; 99.999% needs multi-region and extreme discipline, and costs far more. Percentiles matter because averages hide pain: if 99 requests take 50 ms and one takes 5 seconds, the average is about 100 ms (looks fine), while 1% of users wait 5 seconds. And in a page that makes 20 backend calls, the chance that at least one hits the slow tail is much larger than 1%: 1 - 0.99^20 is about 18%.
How Does It Work?
The nines of availability
text
Availability Downtime per year Per month Per day
99% 3.65 days 7.3 hours 14.4 min
99.9% 8.8 hours 43.8 min 1.4 min
99.99% 52.6 min 4.4 min 8.6 sec
99.999% 5.3 min 26 sec 0.9 sec
Each extra nine cuts allowed downtime by 10 and makes the system much more expensive. Pick a target from the business need: a hobby blog is fine at 99%, a payment API needs 99.99%.
What the Nines Mean in DowntimeEstimation
Request load
99%two nines
3.65 days / year
99.9%three nines
8.8 hours / year
99.99%four nines
52.6 min / year
99.999%five nines
5.3 min / year
Chain of 3 at 99.9%
99.7%
0.999 x 0.999 x 0.999 (all must work)
Long dependency chains lower availability
2 copies at 99%
99.99%
1 - 0.01 x 0.01 (either is enough)
Redundancy multiplies down the failure chance
p99 vs average
18%
chance a 20-call page hits one slow p99 call
Design and monitor tail latency
Key point. Pick the nines from the business need; each extra one needs more redundancy and more money.
Each additional nine cuts allowed downtime by a factor of 10.
Redundancy: the basic tool
Redundancy means having more than one of each critical component, so that one failure does not stop service. The maths shows why it works. If one server is available 99% of the time and failures are independent, then two servers are both down only 0.01 x 0.01 = 0.0001 of the time, so availability becomes 99.99%.
text
Two parallel copies (either one is enough): 1 - (0.01 x 0.01) = 99.99%
Two components in a chain (both are needed): 0.999 x 0.999 = 99.8%
Note the second line: components in series make things worse. A request passing through a load balancer, an app and a database each at 99.9% gets only about 99.7% (0.999^3). So redundancy must be added at every layer, and long call chains are a risk. Also "independent" is the catch: two servers in the same rack, or on the same power or software version, often fail together. Spread across availability zones (separate data centers within a region) and release changes gradually.
Failover
Failover is switching to a healthy copy when the active one fails.
Active-passive (hot standby): one node serves, a standby waits and takes over. Simple, but half the capacity idles and the switch takes seconds to minutes. Data must be copied to the standby continuously (replication), or the standby starts behind.
Active-active: all copies serve traffic. No idle hardware and instant loss tolerance, but data conflicts and capacity planning (remaining nodes must carry the load) are harder.
Failure must be detected (heartbeats, health checks), then acted on (promote a standby, remove from the load balancer). Danger: split brain, where both nodes believe they are the leader. Avoid it with a coordination service or quorum (a majority vote), covered in later chapters.
Active-Passive FailoverArchitecture
Key point. Failover is only as good as the replication behind it and the speed of failure detection.
The standby receives a continuous copy of the data and takes over when heartbeats stop.
Reliability techniques in brief
Replicate data across machines and zones, with backups for disasters or human mistakes (redundancy does not protect against someone deleting a table).
Timeouts and retries with backoff so one slow dependency does not hang everything (Chapter 3).
Graceful degradation: keep core features working when optional ones fail, such as showing the feed without recommendations.
Monitoring and alerting on latency percentiles, error rate and saturation; automated rollbacks for bad releases.
Load shedding: reject some requests cheaply when overloaded, so the rest still succeed.
Latency and throughput together
Increasing load raises latency: as servers get busy, requests queue. Utilization near 100% makes latency explode, which is another reason to keep headroom (about 50-70%). Techniques: caching and CDNs cut latency; parallelism, batching and more servers raise throughput. Batching raises throughput at the cost of latency (waiting to fill a batch), a classic trade-off.
Interview tip. Common mistakes: quoting average latency instead of p99, promising "100% availability", ignoring that serial dependencies multiply failures, forgetting backups (redundancy is not backup), and stating an availability target without saying how the design achieves it.
Interview discussion. "I'll target 99.99% availability and p99 under 200 ms for reads. To get there I'll run at least two of everything across three zones, automatic failover for the database, and load shedding when saturated. Writes can have a looser latency target but must be durable."
Real-World Example
A payments company promises customers 99.95% monthly availability (SLA), about 22 minutes of downtime per month. Internally it sets a stricter SLO of 99.99% (4.4 minutes) so there is room for error before breaking the promise. The gap is called the error budget: while the budget remains, teams ship quickly; when it is spent, they pause features and fix reliability.
System Design Example
For a URL shortener with a 99.99% availability goal on redirects: run redirect servers in three zones behind redundant load balancers, put the data in a store replicated across zones with automatic failover, and keep a cache so a slow database does not stop redirects. The chain is: load balancer (99.99%), service (99.99% with redundancy), cache and database. Series multiplication warns that each layer needs to be better than the target, which is why we make each layer redundant rather than assuming one reliable box. Link creation, less critical, may accept 99.9%. This is the kind of per-operation target differentiation interviewers like to hear.
Trade-off thinking. Every extra nine costs more money and engineering. Availability also trades with consistency and latency: waiting for acknowledgements from several replicas is safer but slower. Choose the target the business needs, not the highest one; "five nines" without justification suggests you have not thought about cost.
Key Interview Takeaway
Describe quality with numbers: p99 latency, throughput, availability nines. Raise availability with redundancy at every layer, across zones, and with automatic failover; remember series chains multiply failures, redundancy is not backup, and averages hide tail latency.
Common Interview Questions
Chapter quiz
Foundations and Interview Thinking · 6 questions
1.In a 45-minute system design interview, which step deserves the largest share of your time?
2.A user taps 'Pay' and the connection drops before the response arrives. The app retries. What makes this safe?
3.A service gets 2 billion requests a day. Using 100,000 seconds per day and a 3x peak factor, what is the approximate peak QPS?
4.Why do sticky sessions make horizontal scaling harder than a shared session store?
5.Request durations vary from 5 ms to 10 seconds across your API. Which load balancing algorithm fits best?
6.A request passes through three components in series, each 99.9% available. What is the approximate end-to-end availability?