p:: System Design
Power of two
ASCII character = 1 byte = 8 bits
Power Approximate value Full name Short name 10 1 Thousand 1 Kilobyte 1 KB 20 1 Million 1 Megabyte 1 MB 30 1 Billion 1 Gigabyte 1 GB 40 1 Trillion 1 Terabyte 1 TB 50 1 Quadrillion 1 Petabyte 1 PB
Latency numbers
Numbers Every Programmer Should Know By Year
curl cheat.sh/latencies
# Latency numbers every programmer should know
1ns Main memory reference: Send 2,000 bytes Read 1,000,000 bytes
ββ 100ns over commodity network: sequentially from SSD:
ββ 22ns 30.856us
L1 cache reference: 1ns β β
ββ 1.0us
ββββββββββββββββββββ SSD random read: 16.0us Disk seek:
Branch mispredict: 3ns βββ 2.1763760000000003ms
ββββββ ββββ
Compress 1KB wth Snappy: Read 1,000,000 bytes
L2 cache reference: 4ns 2.0us sequentially from memory: Read 1,000,000 bytes
ββββββββ ββββββββββββββββββββ 1.869us sequentially from disk:
ββββββββββββββββββββ β 624.999us
Mutex lock/unlock: 16ns β
ββββββββββββββββββββ Round trip
βββββββββββββ 10.0us = ββ in same datacenter: 500.0us Packet roundtrip
ββββββββββββββββββββ ββββββββββββββββββββ CA to Netherlands: 150.0ms
100ns = ββ ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ 1.0ms = ββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ
# [github.com/chubin/late.nz] [MIT License] ββββββββββββββββββββ ββββββββββββββββββββ
# Console port of "Jeff Dean's latency numbers" ββββββββββββββββββββ ββββββββββββββββββββ
# from [github.com/colin-scott/interactive_latencies] ββββββββββββββββββββ
ββββββββββββββββββββ
ns = nanosecond, Β΅s = microsecond, ms = millisecond
1 ns = 10^-9 seconds
1 Β΅s= 10^-6 seconds = 1,000 ns
1 ms = 10^-3 seconds = 1,000 Β΅s = 1,000,000 ns
Availability numbers
High availability is measured as a percentage, with 100% means a service that has 0 downtime
Most services fall between 99% and 100%
Service Level Agreement (SLA)
more the nines, the better
Availability % Downtime per day Downtime per week Downtime per month Downtime per year 99% 14.40 minutes 1.68 hours 7.31 hours 3.65 days 99.99% 8.64 seconds 1.01 minutes 4.38 minutes 52.60 minutes 99.999% 864.00 milliseconds 6.05 seconds 26.30 seconds 5.26 minutes 99.9999% 86.40 milliseconds 604.80 2.63 seconds 31.56 seconds
QPS - Query Per Second
Peak QPS
MAU - Monthly Active Users
DAU - Daily Active Users