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

125
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
CPUMemoryCPU / KernelJava in-process

μs

125
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
CPU / KernelSSDDatabase / CacheNearby NetworkNetworkJava in-processJava frameworkJava JVM

ms

125
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
HDDObject StorageWithin countryNearby regionNeighboring regionFar regionVery farJava frameworkJava JVMWarehouse query

s

125
1
Snowflake: heavy query (typical)1 s
Snowflake: heavy query (bad)5 s
10
100
Warehouse query

Latency Quiz

Test your knowledge

1 / 10Score: 0

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 speedThroughput (÷8)1 GB transfer timeMnemonic
1 Mbps125 KB/s8000 s÷8
10 Mbps1.25 MB/s800 s÷8
100 Mbps12.5 MB/s80 s÷8
1 Gbps125 MB/s8 s÷8
10 Gbps1.25 GB/s0.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

1 / 5Score: 0

What link speed transfers 1 GB in this time?

0.8 s

Cloud Pricing

Approximate monthly costs

WhatAmount$ / Month
CPU1$15
GPU1$5000
Memory1 GB$2
Storage
├Warehouse Storage1 GB$0.02
├Blob (S3, GCS)1 GB$0.02
├Zonal HDD1 GB$0.05
├Ephemeral SSD1 GB$0.08
├Regional HDD1 GB$0.10
├Zonal SSD1 GB$0.20
├Regional SSD1 GB$0.35
Networking
├Same Zone1 GB$0
├Blob1 GB$0
├Ingress1 GB$0
├L4 LB1 GB$0.008
├Inter-Zone1 GB$0.01
├Inter-Region1 GB$0.02
├Internet Egress †1 GB$0.10
CDN Egress1 GB$0.05
CDN Fill ‡1 GB$0.01
Warehouse Query1 GB$0.005
Logs/Traces ♣1 GB$0.50
Metrics1000$20
EKM Keys1$1

Cost Quiz

Test your pricing knowledge

1 / 10Score: 0

What is the monthly cost?

Zonal SSD

Availability Table

Rule-of-thumb downtime to remember

AvailabilityDowntime per year (approx.)MnemonicMeaning
90% (1 nine)36.5 days1 monthThe service is down for a month.
99% (2 nines)3.65 daysLong weekendDown for a long weekend.
99.9% (3 nines)8.76 hours ≈ 500 min500Down for a workday (~9 hours).
99.99% (4 nines)52.6 minutes ≈ 50 min50Down for a lunch break (~50 minutes).
99.999% (5 nines)5.26 minutes ≈ 5 min5Down for a coffee break (~5 minutes).
99.9999% (6 nines)31.5 seconds ≈ 0.5 min0.5Down for half a minute.
99.99999% (7 nines)3.15 seconds3 secDown for a blink (~3 seconds).

Availability Mnemonics Quiz

Test the mnemonics

1 / 7Score: 0

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 valueFull nameShort name
2¹⁰10³1 ThousandKilobyteKB
2²⁰10⁶1 MillionMegabyteMB
2³⁰10⁹1 BillionGigabyteGB
2⁴⁰10¹²1 TrillionTerabyteTB
2⁵⁰10¹⁵1 QuadrillionPetabytePB
2⁶⁰10¹⁸1 QuintillionExabyteEB
2⁷⁰10²¹1 SextillionZettabyteZB
2⁸⁰10²⁴1 SeptillionYottabyteYB

Power of 2 Quiz

Test the units and powers

1 / 8Score: 0

What is the decimal power?

KB