Loading
0x20Lesson 3 of 13

Reason about latency and availability

Use latency numbers, percentiles, and “nines” to set and meet targets.

20 min 6-question quiz
By the end of this lesson you can
  • Compare the rough cost of memory, disk, and network operations.
  • Explain why percentiles matter more than averages.
  • Calculate availability for components in series and in parallel.

Non-functional requirements are usually stated as latency and availability targets. To reason about them you need a feel for how long common operations take, how to describe latency honestly, and how combining components changes overall availability.

Latency and availability, by the numbers

Rough latencies (orders of magnitude): main memory read ~100 ns; SSD random read ~100 µs; round trip within a data center ~0.5 ms; spinning-disk seek ~10 ms; round trip between continents ~100-150 ms. Memory is roughly 1,000× faster than SSD, which is why caches matter.

Percentiles: p50 is the median; p99 is the latency that 99% of requests beat. Averages hide the slow tail that real users feel.

Availability “nines”: 99.9% allows ~8.8 hours of downtime a year; 99.99% ~53 minutes; 99.999% ~5 minutes.

Combining components: if a request needs A and B (in series), availability is A × B, which is lower than either. If either of two replicas can serve (in parallel), availability is 1 − (1 − a)².

What each level allows per year: 99% is about 5,256 minutes of downtime, 99.9% about 526 minutes, and 99.99% about 53 minutes.

Each extra nine costs a lot more engineering: redundancy, automated failover, careful deploys. Teams make targets explicit with an SLI (what you measure, such as the fraction of successful requests), an SLO (the internal target, such as 99.9% over 30 days), and sometimes an SLA (a contract with customers that carries penalties).

Practice: get a feel for latency

Try it

Up to 15 XP

How long does this take?

You don’t need exact numbers, just which order of magnitude each one is in.

0 of 4 sortedScore 0/0
  • “Reading from main memory.”

  • “A random read from an SSD.”

  • “A round trip within a data center.”

  • “A round trip between continents.”

Practice: reach four nines

Try it

Up to 15 XP

Build a path that meets its target

Every request passes through each of these tiers, so they multiply. Reach 99.99% with as few servers as you can.

Add all the replicas you like. Something will still hold you back. What can you do about a tier you can’t replicate?

  1. Load balancerEach instance: 99.900%1 instance
  2. App serverEach instance: 99.000%1 instance
  3. DatabaseEach instance: 99.900%1 instance
  4. Payment providerEach instance: 99.950%Third party: no replicas
Path availability
98.752%
Downtime a year
6,556 minutes
Servers you run
3
This path misses the 99.990% target.

Try it

Up to 15 XP

Quick reliability math

These come up all the time. Estimate each one.

Question 1 of 2Score 0/2
%
You can write 10000, 10k, 1e4 or 10^4.

Key takeaways

  • Memory ≪ SSD ≪ data center round trip ≪ cross-continent round trip.

  • Describe latency with percentiles such as p99, not averages.

  • Series dependencies multiply availability down; redundancy multiplies failure probability down.

Lesson quiz

6 questions · pass with 5 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…