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
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)
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)
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
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)
| Operation | Real-World Duration | Scaled Analogy (1 CPU Cycle = 1s) | Architectural Rule of Thumb |
|---|---|---|---|
| L1 CPU Cache Reference | 0.5 - 1.0 ns | 3 Seconds | Data fits in 64-byte cache lines; zero wait states. |
| Branch Mispredict | 3 - 5 ns | 15 Seconds | CPU pipeline flush; avoid dynamic polymorphic branches in hot paths. |
| L2 / L3 CPU Cache Reference | 7 - 20 ns | 1 Minute | Shared across cores; false sharing triggers core invalidation. |
| Main Memory (DRAM) Access | 100 ns | 5.5 Minutes | In-memory databases (Redis, Memcached) operate at this tier. |
| NVMe SSD Random Read | 10 - 50 μs | 15 Hours | Flash memory is ~500x slower than RAM. Fast for indexed point lookups. |
| Intra-Datacenter Network RTT | 500 μs (0.5 ms) | 19 Days | Internal gRPC RPC overhead between microservices. |
| HDD Mechanical Disk Seek | 5 - 10 ms | 10 Months | Mechanical actuator movement; use append-only sequential writes (LSM-Trees). |
| Cross-Atlantic RTT (NYC to London) | 150 ms | 16 YEARS | Speed-of-light in fiber glass; requires Edge CDNs and local Points of Presence. |
3. CAP & PACELC Database Classification Matrix (15+ Databases)
| Database Engine | CAP Category | PACELC Model | Storage Engine & Consensus | Optimal Production Use Case |
|---|---|---|---|---|
| PostgreSQL / MySQL | CA / CP (Sync) | PC/EC | B+ Tree with Write-Ahead Logging (WAL) streaming replication | E-commerce order checkout, financial ledgers, user authentication |
| Apache Cassandra / ScyllaDB | AP | PA/EL | LSM-Tree with Dynamo Ring, Quorum (R + W > N), Gossip protocol | High-write IoT telemetry, user activity feeds, time-series events |
| Google Cloud Spanner | CP (Strict) | PC/EC | Multi-Paxos per split + TrueTime atomic GPS synchronization | Global multi-region banking, inventory reservation, airline ticketing |
| CockroachDB / TiDB | CP | PC/EC | LSM-Tree (PebblesDB/RocksDB) with Multi-Raft per Range | Horizontally scalable SQL with ACID transactions across cloud regions |
| Amazon DynamoDB | Configurable (AP / CP) | PA/EL (Default) or PC/EC | Multi-AZ Paxos replica groups with partition hash keys | Shopping cart sessions, gaming leaderboards, serverless backends |
| Redis (Cluster) | CP (Shards) | PA/EL | In-Memory Hash Tables / SkipLists with async replica sync | Sub-millisecond caching, rate limiters, pub/sub, live session stores |
| ClickHouse | AP (OLAP) | PA/EL | Columnar MergeTree storage with vectorized SIMD execution | Real-time analytical dashboards, ad-click tracking, log analytics |
| Neo4j | CA / CP | PC/EC | Index-free adjacency graph with pointer traversing | Social relationship graphs, fraud ring detection, knowledge graphs |
4. ANSI SQL Isolation Levels vs Concurrency Anomalies
| Isolation Level | Dirty Read | Non-Repeatable Read | Phantom Read | Write Skew | Implementation Mechanism |
|---|---|---|---|---|---|
| Read Uncommitted | ALLOWED ❌ | ALLOWED ❌ | ALLOWED ❌ | ALLOWED ❌ | No read locks; reads uncommitted buffer pages. |
| Read Committed | PREVENTED ✅ | ALLOWED ❌ | ALLOWED ❌ | ALLOWED ❌ | Postgres/Oracle default (MVCC statement snapshot). |
| Repeatable Read | PREVENTED ✅ | PREVENTED ✅ | PREVENTED ✅* | ALLOWED ❌ | MySQL InnoDB default (*uses Gap Locking for phantoms). |
| Serializable / SSI | PREVENTED ✅ | PREVENTED ✅ | PREVENTED ✅ | PREVENTED ✅ | Strict 2-Phase Locking (2PL) or Serializable Snapshot Isolation. |
5. Caching Strategies & Stampede Mitigations Matrix
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.
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).
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.
- • 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
| Technology | Architecture Model | Ordering Guarantee | Message Retention | Throughput Scale |
|---|---|---|---|---|
| Apache Kafka | Distributed Append-Only Commit Log | Strict per partition key; total order not guaranteed across partitions | Persistent (days/months); consumers track independent offset | Ultra-High (Millions msgs/sec) |
| RabbitMQ | AMQP Smart Broker / Ephemeral Queue | FIFO per queue without concurrent competing consumers | Transient (deleted immediately after consumer ACK) | Medium (~50k - 100k msgs/sec) |
| AWS SQS / GCP PubSub | Fully Managed Serverless Queue | Best-effort (Standard) or Strict FIFO (SQS FIFO with MessageGroupID) | 14 Days max retention; Visibility Timeout lease model | Virtually Unlimited Auto-Scaled |
7. API Protocols & Network Transports Comparison
| Protocol | Transport Layer | Communication Pattern | Serialization Payload | Best Architecture Fit |
|---|---|---|---|---|
| REST (HTTP/1.1 & 2) | TCP | Request / Response (Stateless) | JSON / XML (Human-readable, higher payload) | Public client-facing APIs, CRUD resources, CDN-cacheable GETs |
| gRPC | HTTP/2 (Multiplexed) | Unary, Client/Server Streaming, Bi-directional | Protocol Buffers (Compact Binary) | Internal high-throughput microservice-to-microservice RPCs |
| GraphQL | HTTP/1.1 & 2 | Request / Response + Subscriptions | JSON (Exact client-specified fields) | Complex frontend mobile apps aggregating multiple downstream services |
| WebSockets | TCP (Upgraded from HTTP) | Full-Duplex Persistent Bidirectional | Text / Binary Frames | Real-time chat, multiplayer gaming, financial market orderbooks |
| Server-Sent Events (SSE) | HTTP/1.1 & 2 | Unidirectional Server-to-Client Stream | Text / UTF-8 Stream | LLM token streaming (ChatGPT-style), live stock ticker notifications |
8. Microservices Resiliency & Exponential Backoff Jitter Formulas
• 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.
sleep = rand(0, min(cap, base · 2ᵃᵗᵗᵉᵐᵖᵗ))
Spreads retry spikes uniformly from 0 to exponential cap, eliminating thundering herds.
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
Stateful server-side sessions stored in Redis. Ideal for server-rendered web applications. Protect with `HttpOnly`, `Secure`, `SameSite=Strict`.
Header.Payload.Signature. Verified via RS256 public key without DB lookup. Keep short TTL (15 min) + Refresh Token for revocation.
Delegated authorization framework. Auth Code Grant with PKCE prevents code injection attacks in SPAs and mobile apps.
Mutual TLS encryption and identity verification on every internal RPC between Envoy sidecars. Identity issued via SPIFFE/SPIRE.
10. Essential System Design Interview Formulas
QPS = (Daily Active Users × Actions Per User) / 86,400Peak QPS = Average QPS × 2 (or 3x for spiky event traffic).Cache RAM = Daily Read Volume × 20% (Pareto Principle)20% of content generates 80% of total read traffic.5-Yr Storage = Daily Writes × Avg Payload Size × 365 × 5Add 30% overhead for indexes, replication (3x), and metadata.Bandwidth = Read QPS × Avg Response Size × 8 bitsE.g. 5,000 QPS × 200 KB = 1 GB/s = 8 Gbps egress.