0 XP · 0 scenes

Latency Numbers Every Engineer Should Know

By Vivek Kumar Bhardwaj · Updated · 6 min read

These numbers are the cheat sheet behind most system design estimates. They are approximate and change with hardware, so use them for the order of magnitude, not for exact answers. What matters is the ratio: memory is hundreds of times faster than an SSD, and an SSD is far faster than crossing an ocean.

Latency by operation (approximate)

OperationAbout
Read from CPU cache (L1)1 nanosecond
Read from main memory (RAM)100 nanoseconds
Send 1 KB over a 1 Gbps network10 microseconds
Random read from an SSD100 microseconds
Read 1 MB from memory250 microseconds
Round trip inside one data center0.5 milliseconds
Read 1 MB from an SSD1 millisecond
Disk seek (spinning hard drive)10 milliseconds
Read 1 MB from a hard drive20 milliseconds
Round trip between continents150 milliseconds

What to take from the table

  • Memory beats disk by about three orders of magnitude, which is why caching works so well.
  • Sequential disk reads are far cheaper than random ones. See how disks work.
  • A call to another data center costs more than thousands of memory reads. Keep chatty calls inside one region.
  • Compress before you send over a long link: CPU time is cheap compared with network time.
  • Distance cannot be bought away. A CDN helps by moving the data closer to the user.

Powers of two

PowerValueName
2^10about 1 thousand1 KB
2^20about 1 million1 MB
2^30about 1 billion1 GB
2^40about 1 trillion1 TB

Uptime and the nines

AvailabilityDowntime per yearPer month
99% (two nines)about 3.65 daysabout 7.3 hours
99.9% (three nines)about 8.8 hoursabout 44 minutes
99.99% (four nines)about 53 minutesabout 4.4 minutes
99.999% (five nines)about 5.3 minutesabout 26 seconds

Quick estimation tricks

  • A day has 86,400 seconds, which is close to 100,000. So 1 million requests a day is about 12 per second, and 100 million a day is about 1,200 per second.
  • Peak traffic is often 2 to 3 times the average. Design for the peak.
  • 1 billion records of 1 KB each is about 1 TB of raw data, before copies and indexes.
  • Reads usually outnumber writes. State your assumed ratio, for example 10 reads for every write.

Practise these in the estimation lesson and the latency lesson, both with simulators.