p:: System Design

Power of two

  • ASCII character = 1 byte = 8 bits
PowerApproximate valueFull nameShort name
101 Thousand1 Kilobyte1 KB
201 Million1 Megabyte1 MB
301 Billion1 Gigabyte1 GB
401 Trillion1 Terabyte1 TB
501 Quadrillion1 Petabyte1 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 dayDowntime per weekDowntime per monthDowntime per year
99%14.40 minutes1.68 hours7.31 hours3.65 days
99.99%8.64 seconds1.01 minutes4.38 minutes52.60 minutes
99.999%864.00 milliseconds6.05 seconds26.30 seconds5.26 minutes
99.9999%86.40 milliseconds604.802.63 seconds31.56 seconds
  • QPS - Query Per Second
  • Peak QPS
  • MAU - Monthly Active Users
  • DAU - Daily Active Users