โœ๏ธ Napkin Math

How fast is your computer, really? Numbers every programmer should know.

๐Ÿ’ก TL;DR

Your computer does things at wildly different speeds. Reading from memory? Nanoseconds. Reading from disk? Milliseconds. That's a million times slower! Knowing these rough numbers helps you build faster software without over-engineering.

โšก The Speed Ladder

If reading from CPU cache took 1 second, here's how long everything else would take:

๐Ÿง 
CPU Cache (L1)
~0.5 nanoseconds - Like remembering your own name
๐Ÿ’พ
RAM (Sequential)
~50 microseconds/MB - Like reading a book on your desk
๐Ÿ’ฟ
SSD (Sequential)
~100 microseconds/MB - Like grabbing a book from the shelf
๐ŸŒ
Network (Same Zone)
~100 microseconds/MB - Like yelling to your neighbor
๐Ÿ—„๏ธ
SSD (Random)
~100 microseconds latency - Like finding a random page in a book
๐ŸŒ
Network (Cross-Region)
~80ms latency - Like mailing a letter across the country
๐Ÿ“€
HDD (Random)
~10ms latency - Like driving to the library for one book

๐ŸŒ Global Network Latency

Drag to rotate. Hover over arcs to see latency between cloud regions.

< 50ms (Same region)
50-100ms (Cross-continent)
> 100ms (Intercontinental)

๐Ÿ“Š Latency Reference Table

Source Destination Distance Latency Bandwidth
๐Ÿ‡บ๐Ÿ‡ธ US East ๐Ÿ‡บ๐Ÿ‡ธ US Central 1,500 km 25ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US Central ๐Ÿ‡บ๐Ÿ‡ธ US West 2,400 km 40ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US East ๐Ÿ‡บ๐Ÿ‡ธ US West 3,700 km 60ms ~25 MB/s
๐Ÿ‡ฎ๐Ÿ‡ช EU West ๐Ÿ‡ฉ๐Ÿ‡ช EU Central 1,100 km 20ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US East ๐Ÿ‡ฎ๐Ÿ‡ช EU West 5,900 km 80ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US Central ๐Ÿ‡ฎ๐Ÿ‡ช EU West 6,800 km 100ms ~25 MB/s
๐Ÿ‡น๐Ÿ‡ผ Asia East ๐Ÿ‡ฏ๐Ÿ‡ต Tokyo 2,100 km 50ms ~25 MB/s
๐Ÿ‡น๐Ÿ‡ผ Asia East ๐Ÿ‡ธ๐Ÿ‡ฌ Singapore 3,200 km 70ms ~25 MB/s
๐Ÿ‡ธ๐Ÿ‡ฌ Singapore ๐Ÿ‡ฆ๐Ÿ‡บ Sydney 6,300 km 100ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US East ๐Ÿ‡ง๐Ÿ‡ท Sรฃo Paulo 7,700 km 120ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US West ๐Ÿ‡น๐Ÿ‡ผ Asia East 10,500 km 140ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US West ๐Ÿ‡ฆ๐Ÿ‡บ Sydney 12,100 km 150ms ~25 MB/s
๐Ÿ‡ฎ๐Ÿ‡ช EU West ๐Ÿ‡ธ๐Ÿ‡ฌ Singapore 10,800 km 160ms ~25 MB/s
๐Ÿ‡บ๐Ÿ‡ธ US West ๐Ÿ‡ธ๐Ÿ‡ฌ Singapore 13,600 km 180ms ~25 MB/s
๐Ÿ’ก Speed of Light in Fiber

Light travels ~200 km/ms in fiber optic cable. A 10,000 km route has a theoretical minimum of ~50ms one-way, ~100ms round-trip. Real-world latency is higher due to routing, switching, and protocol overhead.

๐Ÿข Data Center Architecture Simulation

Interactive visualization of regions, availability zones, and network latencies. Click on elements to see details. Packets animate between nodes to show relative speeds.

๐Ÿ‘† Click a region or AZ for details

This simulation shows how data centers are organized into regions (geographic areas) containing multiple availability zones (isolated data centers). Packets animate between nodes to visualize relative network speeds.

Region
Availability Zone
Node / Instance
<1ms (Intra-AZ)
1-5ms (Cross-AZ)
20-100ms+ (Cross-Region)

๐Ÿ“Š Network Latency Reference

Connection Type Distance Latency Bandwidth Cost
๐ŸŸข Same AZ (intra-zone) <1 km <0.5ms 10+ Gbps Free
๐ŸŸก Cross-AZ (same region) 10-100 km 1-2ms 5-10 Gbps $0.01/GB
๐Ÿ”ด Cross-Region (same continent) 1,000-4,000 km 20-60ms ~25 MB/s $0.02/GB
๐Ÿ”ด Cross-Region (intercontinental) 5,000-12,000 km 80-180ms ~25 MB/s $0.05-0.10/GB

๐ŸŽฏ The Magic Numbers

Memorize these. They'll help you estimate if your system design makes sense.

๐Ÿ’พ
Memory Bandwidth
200
GB/s (threaded)
๐Ÿ’ฟ
SSD Sequential
8
GB/s read
๐ŸŒ
Network (Same Zone)
10
GB/s
๐Ÿ”
Crypto Hash
1
GB/s
๐Ÿ“ฆ
Compression
500
MB/s
๐Ÿ—ƒ๏ธ
JSON Parsing
1
GB/s (simdjson)
๐Ÿƒ Human Scale Analogy

If a CPU cycle (0.3ns) was 1 second:

โฑ๏ธ How Long to Read 1 GB?

5 ms
From RAM (threaded) - blink of an eye
50 ms
From RAM (single thread)
100 ms
From SSD (sequential) - barely noticeable
100 ms
Over network (same zone)
1 second
Decompress or crypto-hash it
10 seconds
From blob storage (S3/GCS)
15 seconds
From SSD (random reads) ๐Ÿ˜ฌ
30 minutes
From HDD (random reads) ๐Ÿ’€

๐Ÿ’ฐ What Does It Cost?

Cloud pricing for the things you care about (monthly, on-demand):

Resource Amount Price With Commitment
โ˜๏ธ CPU (1 vCPU) 1 core $15/mo $10/mo
๐Ÿง  Memory 1 GB $2/mo $1/mo
๐Ÿชฃ Blob Storage (S3) 1 GB $0.02/mo -
๐Ÿ’ฟ SSD (Zonal) 1 GB $0.20/mo -
๐ŸŒ Network Egress 1 GB $0.10 -
๐Ÿ“Š Logs/Traces 1 GB $0.50 -
๐ŸŽฎ GPU 1 GPU $5,000/mo $3,000/mo
๐Ÿ’ก Quick Mental Math

Logging costs: 100k requests/sec ร— 1KB each = 100MB/sec = 8.6TB/day = ~$4,300/mo in log storage alone!

Egress trap: Serving 1 PB/month to users = $100,000 in egress fees ๐Ÿ˜ฑ

๐Ÿงช Test Yourself!

Your app processes 10,000 requests/second. Each request reads 1MB from RAM. Can a single server handle this?
โœ… Yes, easily
โŒ No way
๐Ÿคท Need more servers
You need to copy 1TB between two servers in the same data center. How long?
โšก ~10 seconds
๐Ÿ• ~2 minutes
โฐ ~30 minutes
Random SSD reads vs sequential: how much slower?
2x slower
10x slower
100x slower

๐ŸŽ“ The Four Rules of Napkin Math

๐ŸŽฏ
Keep It Simple

If your estimate needs more than 6 assumptions, you're overcomplicating it.

๐Ÿ“
Keep Units

GB/s ร— seconds = GB. Units are your sanity check.

๐Ÿ”ข
Think in Powers of 10

Is it ~10ms or ~100ms? That's what matters, not 47ms vs 52ms.

๐Ÿงฉ
Fermi Decomposition

Break big questions into smaller guessable pieces.