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)
| Operation | About |
|---|
| Read from CPU cache (L1) | 1 nanosecond |
| Read from main memory (RAM) | 100 nanoseconds |
| Send 1 KB over a 1 Gbps network | 10 microseconds |
| Random read from an SSD | 100 microseconds |
| Read 1 MB from memory | 250 microseconds |
| Round trip inside one data center | 0.5 milliseconds |
| Read 1 MB from an SSD | 1 millisecond |
| Disk seek (spinning hard drive) | 10 milliseconds |
| Read 1 MB from a hard drive | 20 milliseconds |
| Round trip between continents | 150 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
| Power | Value | Name |
|---|
| 2^10 | about 1 thousand | 1 KB |
| 2^20 | about 1 million | 1 MB |
| 2^30 | about 1 billion | 1 GB |
| 2^40 | about 1 trillion | 1 TB |
Uptime and the nines
| Availability | Downtime per year | Per month |
|---|
| 99% (two nines) | about 3.65 days | about 7.3 hours |
| 99.9% (three nines) | about 8.8 hours | about 44 minutes |
| 99.99% (four nines) | about 53 minutes | about 4.4 minutes |
| 99.999% (five nines) | about 5.3 minutes | about 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.