Limited Offer

30% OFF Lifetime Access ($139) with code SYSTEM30

SYSTEM DESIGN MASTER REFERENCE MATRIX

Staff-Level Architecture Tables & Reference Cheat Sheets

The definitive quick-reference companion for technical interviews and architecture reviews. Sizing constants, hardware physics, CAP/PACELC database matrices, caching stampede algorithms, and resiliency formulas.

1. Back-of-the-Envelope Scale Estimation Constants

Seconds in Time

86,400 ≈ 10⁵ / Day

• 1M req/day ≈ 12 QPS
• 100M req/day ≈ 1,200 QPS (Peak ≈ 2.4k)
• 1B req/day ≈ 12,000 QPS (Peak ≈ 24k)

Storage Multipliers

Powers of Two (2¹⁰)

• 2¹⁰ = 1 KB (1,024 B)
• 2²⁰ = 1 MB (10⁶ B)
• 2³⁰ = 1 GB (10⁹ B)
• 2⁴⁰ = 1 TB (10¹² B) • 2⁵⁰ = 1 PB (10¹⁵ B)

Availability "Nines"

99.99% = 52 Min / Yr

• 99.0% (2 nines) = 3.65 days/yr
• 99.9% (3 nines) = 8.76 hrs/yr
• 99.99% (4 nines) = 52.6 min/yr
• 99.999% (5 nines) = 5.26 min/yr

Throughput Bandwidth

1 Gbps ≈ 125 MB/s

• 1 Byte = 8 bits
• 10 Gbps NIC = 1.25 GB/sec payload
• 40 Gbps NIC = 5 GB/sec payload
• 100 Gbps Backbone = 12.5 GB/sec

2. Hardware & Network Latency Physics Hierarchy (Jeff Dean Numbers)

OperationReal-World DurationScaled Analogy (1 CPU Cycle = 1s)Architectural Rule of Thumb
L1 CPU Cache Reference0.5 - 1.0 ns3 SecondsData fits in 64-byte cache lines; zero wait states.
Branch Mispredict3 - 5 ns15 SecondsCPU pipeline flush; avoid dynamic polymorphic branches in hot paths.
L2 / L3 CPU Cache Reference7 - 20 ns1 MinuteShared across cores; false sharing triggers core invalidation.
Main Memory (DRAM) Access100 ns5.5 MinutesIn-memory databases (Redis, Memcached) operate at this tier.
NVMe SSD Random Read10 - 50 μs15 HoursFlash memory is ~500x slower than RAM. Fast for indexed point lookups.
Intra-Datacenter Network RTT500 μs (0.5 ms)19 DaysInternal gRPC RPC overhead between microservices.
HDD Mechanical Disk Seek5 - 10 ms10 MonthsMechanical actuator movement; use append-only sequential writes (LSM-Trees).
Cross-Atlantic RTT (NYC to London)150 ms16 YEARSSpeed-of-light in fiber glass; requires Edge CDNs and local Points of Presence.

3. CAP & PACELC Database Classification Matrix (15+ Databases)

Database EngineCAP CategoryPACELC ModelStorage Engine & ConsensusOptimal Production Use Case
PostgreSQL / MySQLCA / CP (Sync)PC/ECB+ Tree with Write-Ahead Logging (WAL) streaming replicationE-commerce order checkout, financial ledgers, user authentication
Apache Cassandra / ScyllaDBAPPA/ELLSM-Tree with Dynamo Ring, Quorum (R + W > N), Gossip protocolHigh-write IoT telemetry, user activity feeds, time-series events
Google Cloud SpannerCP (Strict)PC/ECMulti-Paxos per split + TrueTime atomic GPS synchronizationGlobal multi-region banking, inventory reservation, airline ticketing
CockroachDB / TiDBCPPC/ECLSM-Tree (PebblesDB/RocksDB) with Multi-Raft per RangeHorizontally scalable SQL with ACID transactions across cloud regions
Amazon DynamoDBConfigurable (AP / CP)PA/EL (Default) or PC/ECMulti-AZ Paxos replica groups with partition hash keysShopping cart sessions, gaming leaderboards, serverless backends
Redis (Cluster)CP (Shards)PA/ELIn-Memory Hash Tables / SkipLists with async replica syncSub-millisecond caching, rate limiters, pub/sub, live session stores
ClickHouseAP (OLAP)PA/ELColumnar MergeTree storage with vectorized SIMD executionReal-time analytical dashboards, ad-click tracking, log analytics
Neo4jCA / CPPC/ECIndex-free adjacency graph with pointer traversingSocial relationship graphs, fraud ring detection, knowledge graphs

4. ANSI SQL Isolation Levels vs Concurrency Anomalies

Isolation LevelDirty ReadNon-Repeatable ReadPhantom ReadWrite SkewImplementation Mechanism
Read UncommittedALLOWED ❌ALLOWED ❌ALLOWED ❌ALLOWED ❌No read locks; reads uncommitted buffer pages.
Read CommittedPREVENTED ✅ALLOWED ❌ALLOWED ❌ALLOWED ❌Postgres/Oracle default (MVCC statement snapshot).
Repeatable ReadPREVENTED ✅PREVENTED ✅PREVENTED ✅*ALLOWED ❌MySQL InnoDB default (*uses Gap Locking for phantoms).
Serializable / SSIPREVENTED ✅PREVENTED ✅PREVENTED ✅PREVENTED ✅Strict 2-Phase Locking (2PL) or Serializable Snapshot Isolation.

5. Caching Strategies & Stampede Mitigations Matrix

Cache-Aside (Lazy Loading)

Flow: App reads cache. If miss, app reads DB, writes result to cache with TTL, and returns.
Pros: Only requested data cached; node failures resilient.
Cons: Cache misses suffer 3 network trips; stale data window.

Write-Through Cache

Flow: App writes to cache; cache synchronously writes to DB before confirming.
Pros: High consistency; fresh data always in cache.
Cons: Higher write latency (2 sequential writes).

Write-Back (Write-Behind)

Flow: App writes to cache immediately; cache asynchronously batches writes to DB.
Pros: Ultra-fast write throughput; write coalescing.
Cons: Risk of data loss if cache crashes before flush.

🛡️ Cache Stampede (Thundering Herd) Solutions:
  • • Mutex Locking (Single-Flight): First request acquires a distributed lock (Redis SET NX EX) to fetch from DB; concurrent requests wait or poll.
  • • Probabilistic Early Expiration (XFetch Algorithm): Background worker recomputes key before it expires based on compute time formula: now - β * delta * ln(random()) > TTL.
  • • Stale-While-Revalidate: Serve slightly stale cached value to clients while an async background thread queries DB to refresh.

6. Message Broker & Event Streaming Comparison Matrix

TechnologyArchitecture ModelOrdering GuaranteeMessage RetentionThroughput Scale
Apache KafkaDistributed Append-Only Commit LogStrict per partition key; total order not guaranteed across partitionsPersistent (days/months); consumers track independent offsetUltra-High (Millions msgs/sec)
RabbitMQAMQP Smart Broker / Ephemeral QueueFIFO per queue without concurrent competing consumersTransient (deleted immediately after consumer ACK)Medium (~50k - 100k msgs/sec)
AWS SQS / GCP PubSubFully Managed Serverless QueueBest-effort (Standard) or Strict FIFO (SQS FIFO with MessageGroupID)14 Days max retention; Visibility Timeout lease modelVirtually Unlimited Auto-Scaled

7. API Protocols & Network Transports Comparison

ProtocolTransport LayerCommunication PatternSerialization PayloadBest Architecture Fit
REST (HTTP/1.1 & 2)TCPRequest / Response (Stateless)JSON / XML (Human-readable, higher payload)Public client-facing APIs, CRUD resources, CDN-cacheable GETs
gRPCHTTP/2 (Multiplexed)Unary, Client/Server Streaming, Bi-directionalProtocol Buffers (Compact Binary)Internal high-throughput microservice-to-microservice RPCs
GraphQLHTTP/1.1 & 2Request / Response + SubscriptionsJSON (Exact client-specified fields)Complex frontend mobile apps aggregating multiple downstream services
WebSocketsTCP (Upgraded from HTTP)Full-Duplex Persistent BidirectionalText / Binary FramesReal-time chat, multiplayer gaming, financial market orderbooks
Server-Sent Events (SSE)HTTP/1.1 & 2Unidirectional Server-to-Client StreamText / UTF-8 StreamLLM token streaming (ChatGPT-style), live stock ticker notifications

8. Microservices Resiliency & Exponential Backoff Jitter Formulas

Circuit Breaker States

• Closed: Normal routing. Tracks error rate %.
• Open: Threshold exceeded (>50% fail). Fail-fast instantly without calling downstream.
• Half-Open: After cooldown timeout, test probe request. If success, close circuit.

Full Jitter Formula

sleep = rand(0, min(cap, base · 2ᵃᵗᵗᵉᵐᵖᵗ))

Spreads retry spikes uniformly from 0 to exponential cap, eliminating thundering herds.

Decorrelated Jitter

sleep = min(cap, rand(base, sleep_prev · 3))

Best overall performance: prevents long wait clusters while avoiding synchronized retry spikes.

9. Security & Authentication Architecture Matrix

Session Cookies

Stateful server-side sessions stored in Redis. Ideal for server-rendered web applications. Protect with `HttpOnly`, `Secure`, `SameSite=Strict`.

JWT (Stateless)

Header.Payload.Signature. Verified via RS256 public key without DB lookup. Keep short TTL (15 min) + Refresh Token for revocation.

OAuth 2.0 + PKCE

Delegated authorization framework. Auth Code Grant with PKCE prevents code injection attacks in SPAs and mobile apps.

Zero Trust & mTLS

Mutual TLS encryption and identity verification on every internal RPC between Envoy sidecars. Identity issued via SPIFFE/SPIRE.

10. Essential System Design Interview Formulas

1. Read & Write QPSQPS = (Daily Active Users × Actions Per User) / 86,400Peak QPS = Average QPS × 2 (or 3x for spiky event traffic).
2. Cache RAM Sizing (80/20 Rule)Cache RAM = Daily Read Volume × 20% (Pareto Principle)20% of content generates 80% of total read traffic.
3. 5-Year Storage Capacity5-Yr Storage = Daily Writes × Avg Payload Size × 365 × 5Add 30% overhead for indexes, replication (3x), and metadata.
4. Network Egress BandwidthBandwidth = Read QPS × Avg Response Size × 8 bitsE.g. 5,000 QPS × 200 KB = 1 GB/s = 8 Gbps egress.