Numbers Every Programmer Should Know
This page is made for memorization.
Latency Numbers
Every programmer should know
A learning tool to help memorize napkin math. Reference: sirupsen/napkin-math
Network RTT tiers (universal): 20 / 40 / 60 / 120 / 200 ms — within country, nearby region, neighboring region, far region, very far. India and US example routes share the same tier cells.
Filter grid
Group: 18 / 18 categories visible (3 hardware,7 network,3 java,4 storage,1 warehouse)
Each grid is arranged by multiples of 1, 2, 5 across the columns and multipliers 1, 10, 100 down the rows. One grid per unit — ns, μs, ms, s — from fastest to slowest. Colors track the entry category, and overall hotter shades (reds) mark the fastest hardware, cooling toward blues and purples as latency climbs.
Warehouse queries (very high level).Snowflake query times depend on warehouse size, data volume, caching, and query plan. Entries in the ms and s grids are napkin anchors, not benchmarks.
ns
| 1 | 2 | 5 | |
|---|---|---|---|
| 1 | Sequential Memory R/W (64 bytes)0.5 ns | Branch misprediction3 ns | |
| 10 | Hashing, not crypto-safe (64 bytes)10 ns | Random Memory R/W (64 bytes)20 ns | Virtual thread create50 ns |
| 100 | HashMap get100 ns Virtual thread context switch100 ns Hashing, crypto-safe (64 bytes)100 ns | System Call300 ns |
μs
| 1 | 2 | 5 | |
|---|---|---|---|
| 1 | Sequential SSD read (8 KiB)1 μs JSON serialize 1 KB1 μs Log line (sync)1 μs | Sequential SSD write, -fsync (8 KiB)2 μs | |
| 10 | Context Switch10 μs Platform thread context switch10 μs | TCP Echo Server (32 KiB)50 μs Proxy: Envoy/ProxySQL/Nginx/HAProxy50 μs | |
| 100 | Random SSD Read (8 KiB)100 μs Spring MVC dispatch100 μs | Network within same region250 μs Premium network within zone/VPC250 μs Sequential SSD write, +fsync (8 KiB)300 μs | {MySQL, Memcached, Redis, ...} Query500 μs |
ms
| 1 | 2 | 5 | |
|---|---|---|---|
| 1 | JDBC pool checkout1 ms Platform thread create1 ms | JDBC round-trip (no pool)2 ms | |
| 10 | Sequential HDD Read (8 KiB)10 ms Young GC pause10 ms Random HDD Read (8 KiB)10 ms | Network within India20 ms NA Central ↔ East25 ms Blob Storage GET, if-not-match 30430 ms | India ↔ Singapore40 ms NA Central ↔ West40 ms India ↔ Dubai60 ms NA East ↔ West60 ms |
| 100 | Blob Storage GET, 1 conn (128 KiB)80 ms Blob Storage GET, n conn (offsets)80 ms EU West ↔ NA East80 ms Blob Storage LIST100 ms India ↔ Europe120 ms | NA West ↔ Singapore180 ms Blob Storage PUT, 1 conn (128 KiB)200 ms Blob Storage PUT, n conn (multipart)200 ms India ↔ US240 ms Snowflake: simple query250 ms | Full GC pause500 ms Snowflake: moderate / less optimized500 ms |
s
| 1 | 2 | 5 | |
|---|---|---|---|
| 1 | Snowflake: heavy query (typical)1 s | Snowflake: heavy query (bad)5 s | |
| 10 | |||
| 100 |
Latency Quiz
Test your knowledge
What operation has this latency?
5 × 10⁻¹ s
Bandwidth
Throughput and transfer time (÷8)
1 Gbps ≈ 125 MB/s. 1 GB over 1 Gbps = 8 seconds. Same fact, two angles.
| Link speed | Throughput (÷8) | 1 GB transfer time | Mnemonic |
|---|---|---|---|
| 1 Mbps | 125 KB/s | 8000 s | ÷8 |
| 10 Mbps | 1.25 MB/s | 800 s | ÷8 |
| 100 Mbps | 12.5 MB/s | 80 s | ÷8 |
| 1 Gbps | 125 MB/s | 8 s | ÷8 |
| 10 Gbps | 1.25 GB/s | 0.8 s | ÷8 |
Bits to bytes: divide link speed by 8. 1 Gbps ≈ 125 MB/s. 1 GB over 1 Gbps = 8 seconds.
Bandwidth Quiz
Test your ÷8 reflex
What link speed transfers 1 GB in this time?
0.8 s
Cloud Pricing
Approximate monthly costs
| What | Amount | $ / Month |
|---|---|---|
| CPU | 1 | $15 |
| GPU | 1 | $5000 |
| Memory | 1 GB | $2 |
| Storage | ||
| ├Warehouse Storage | 1 GB | $0.02 |
| ├Blob (S3, GCS) | 1 GB | $0.02 |
| ├Zonal HDD | 1 GB | $0.05 |
| ├Ephemeral SSD | 1 GB | $0.08 |
| ├Regional HDD | 1 GB | $0.10 |
| ├Zonal SSD | 1 GB | $0.20 |
| ├Regional SSD | 1 GB | $0.35 |
| Networking | ||
| ├Same Zone | 1 GB | $0 |
| ├Blob | 1 GB | $0 |
| ├Ingress | 1 GB | $0 |
| ├L4 LB | 1 GB | $0.008 |
| ├Inter-Zone | 1 GB | $0.01 |
| ├Inter-Region | 1 GB | $0.02 |
| ├Internet Egress † | 1 GB | $0.10 |
| CDN Egress | 1 GB | $0.05 |
| CDN Fill ‡ | 1 GB | $0.01 |
| Warehouse Query | 1 GB | $0.005 |
| Logs/Traces ♣ | 1 GB | $0.50 |
| Metrics | 1000 | $20 |
| EKM Keys | 1 | $1 |
Cost Quiz
Test your pricing knowledge
What is the monthly cost?
Zonal SSD
Availability Table
Rule-of-thumb downtime to remember
| Availability | Downtime per year (approx.) | Mnemonic | Meaning |
|---|---|---|---|
| 90% (1 nine) | 36.5 days | 1 month | The service is down for a month. |
| 99% (2 nines) | 3.65 days | Long weekend | Down for a long weekend. |
| 99.9% (3 nines) | 8.76 hours ≈ 500 min | 500 | Down for a workday (~9 hours). |
| 99.99% (4 nines) | 52.6 minutes ≈ 50 min | 50 | Down for a lunch break (~50 minutes). |
| 99.999% (5 nines) | 5.26 minutes ≈ 5 min | 5 | Down for a coffee break (~5 minutes). |
| 99.9999% (6 nines) | 31.5 seconds ≈ 0.5 min | 0.5 | Down for half a minute. |
| 99.99999% (7 nines) | 3.15 seconds | 3 sec | Down for a blink (~3 seconds). |
Availability Mnemonics Quiz
Test the mnemonics
Which availability level does this describe?
Down for a coffee break (~5 minutes).
Threads: Platform vs Virtual
Java concurrency napkin math
| Metric | 🧵 Platform Threads (OS-level) | 🍃 Virtual Threads (Java 21+) |
|---|---|---|
| Memory overhead | ~1 MB per thread (stack-allocated) | ~2 KB to 10 KB per thread (heap-allocated) |
| Creation time | ~1 to 2 ms (OS kernel system call) | ~10 to 50 ns (Java object allocation) |
| Max capacity | ~1,000 to 5,000 per server (OOM risk) | Millions on a standard laptop |
| Context switch cost | ~1 to 10 μs (heavy OS operation) | ~100 ns (managed by the JVM) |
Platform threads map 1:1 to OS threads — heavy and scarce. Virtual threads (Java 21+) are cheap JVM-managed tasks, so you can run millions concurrently instead of a few thousand.
Power of 2
Data volume in distributed systems boils down to basics: a byte is a sequence of 8 bits; an ASCII character uses one byte of memory. Units are powers of 2: 210 = 1024 ≈ 103 = 1000 (1 Thousand), and so on.
Reference: ByteByteGo — Back of the Envelope Estimation
| Power (2ⁿ) | Power (10ⁿ) | Approximate value | Full name | Short name |
|---|---|---|---|---|
| 2¹⁰ | 10³ | 1 Thousand | Kilobyte | KB |
| 2²⁰ | 10⁶ | 1 Million | Megabyte | MB |
| 2³⁰ | 10⁹ | 1 Billion | Gigabyte | GB |
| 2⁴⁰ | 10¹² | 1 Trillion | Terabyte | TB |
| 2⁵⁰ | 10¹⁵ | 1 Quadrillion | Petabyte | PB |
| 2⁶⁰ | 10¹⁸ | 1 Quintillion | Exabyte | EB |
| 2⁷⁰ | 10²¹ | 1 Sextillion | Zettabyte | ZB |
| 2⁸⁰ | 10²⁴ | 1 Septillion | Yottabyte | YB |
Power of 2 Quiz
Test the units and powers
What is the decimal power?
KB