Forem

Thesius Code
Thesius Code

Posted on • Originally published at datanest-stores.pages.dev

System Design Cheat Sheets

System Design Cheat Sheets

50+ system architecture patterns and real-world design references for system design interviews. Covers fundamental building blocks (load balancers, caches, databases, queues), classic interview problems (URL shortener, chat app, newsfeed), and advanced distributed systems concepts. Your portable reference for whiteboard interviews.

Key Features

  • 50+ architecture diagrams in text-based format (copy-paste into any doc)
  • 12 classic system design problems with step-by-step solutions
  • Building blocks reference — when to use which component
  • Back-of-envelope estimation guide — latency, throughput, storage calculations
  • Tradeoff matrices for every major architectural decision
  • Interview framework — the 4-step approach that structures any answer

Content Organization

Section Items Purpose
Building Blocks 15 cheatsheets Individual component deep-dives
Classic Problems 12 full designs End-to-end system design solutions
Estimation Reference 1 comprehensive guide Numbers every engineer should know
Tradeoff Matrices 10 decision guides SQL vs NoSQL, push vs pull, etc.
Advanced Concepts 15 topic sheets CAP, consensus, consistent hashing

Sample Content

The 4-Step Interview Framework

Step 1: CLARIFY (3-5 min)
  - Functional requirements (what does the system do?)
  - Non-functional requirements (scale, latency, availability)
  - Constraints (budget, team size, existing infra)

Step 2: ESTIMATE (3-5 min)
  - Users, QPS, storage, bandwidth
  - Read vs write ratio
  - Peak vs average load

Step 3: DESIGN (20-25 min)
  - API design → Data model → High-level architecture
  - Deep-dive on 2-3 critical components
  - Address non-functional requirements

Step 4: EXTEND (5-10 min)
  - Scaling bottlenecks and solutions
  - Monitoring and alerting
  - Failure modes and recovery
Enter fullscreen mode Exit fullscreen mode

Classic Problem: Design a URL Shortener

Requirements: 100M URLs created/month, 10:1 read-to-write ratio, URLs expire after 5 years.

Estimation:

Writes:  100M / month ≈ 40 writes/sec (avg), ~400/sec (peak)
Reads:   1B / month   ≈ 400 reads/sec (avg), ~4000/sec (peak)
Storage: 100M × 12 months × 5 years × 500 bytes ≈ 3 TB
Enter fullscreen mode Exit fullscreen mode

Architecture:

Client → Load Balancer → API Servers (stateless)
                              │
              ┌───────────────┼───────────────┐
              ▼               ▼               ▼
         Write Path       Read Path       Analytics
              │               │               │
              ▼               ▼               ▼
         ID Generator    Redis Cache      Kafka → OLAP
         (Snowflake)     (hot URLs)       (click tracking)
              │               │
              ▼               ▼
         ┌─────────────────────┐
         │   PostgreSQL /      │
         │   DynamoDB          │
         │   (short_code → url)│
         └─────────────────────┘
Enter fullscreen mode Exit fullscreen mode

Key decisions:

  • ID generation: Base62 encoding of auto-increment vs random hash. Tradeoff: predictability vs collision risk.
  • Cache strategy: Cache top 20% of URLs (Pareto principle). LRU eviction. Cache-aside pattern.
  • Database choice: DynamoDB for single-key lookups at scale vs PostgreSQL for simpler operations.

Building Block: Caching Strategies

Strategy How It Works Best For
Cache-Aside App checks cache first, loads from DB on miss General-purpose read-heavy
Write-Through App writes to cache, cache writes to DB Strong consistency needs
Write-Behind App writes to cache, cache async writes to DB High write throughput
Read-Through Cache loads from DB transparently Simplifying app code
Cache-Aside Pattern:
  1. App: GET key from cache
  2. Cache HIT → return data
  3. Cache MISS → query DB → store in cache → return data
  4. On write: update DB → invalidate cache entry

  Pitfall: Cache stampede on popular key expiry
  Fix: Mutex lock or staggered TTLs
Enter fullscreen mode Exit fullscreen mode

Numbers Every Engineer Should Know

Operation                          Time
─────────────────────────────────  ──────────
L1 cache reference                 0.5 ns
L2 cache reference                   7 ns
Main memory reference              100 ns
SSD random read                    150 μs
HDD random read                    10 ms
Send 1 KB over 1 Gbps network      10 μs
Read 1 MB from SSD                  1 ms
Read 1 MB from HDD                 20 ms
Round trip within datacenter      500 μs
Round trip US coast to coast       40 ms

Quick math:
  1M requests/day    ≈ 12 QPS
  100M requests/day  ≈ 1,200 QPS
  1B requests/day    ≈ 12,000 QPS
Enter fullscreen mode Exit fullscreen mode

Study Plan

Week Focus Daily Time
1 Building blocks: databases, caching, load balancing 45 min
2 Building blocks: message queues, CDNs, consensus 45 min
3 Classic problems: URL shortener, paste bin, rate limiter 60 min
4 Classic problems: chat app, newsfeed, notification system 60 min
5 Advanced: search engine, video streaming, distributed KV store 60 min
6 Practice: timed design sessions (35 min per problem) 60 min

Practice Tips

  1. Use the 4-step framework religiously. Interviewers evaluate your process, not just the answer.
  2. Practice estimation until it's automatic. "100M users, 10% DAU, 5 requests each = 50M/day ≈ 600 QPS."
  3. Draw before you talk. Sketch the high-level diagram first, then narrate.
  4. Go deep on 2-3 components. Don't try to cover everything — interviewers want depth.
  5. Always discuss failure modes. "What happens when this cache node goes down?"

Contents

  • src/ — All 50+ cheatsheets in Markdown (printable, searchable)
  • examples/ — 12 classic problems with full step-by-step solutions
  • docs/ — Estimation reference card, interview framework poster

This is 1 of 11 resources in the Interview Prep Pro toolkit. Get the complete [System Design Cheat Sheets] with all files, templates, and documentation for $39.

Get the Full Kit →

Or grab the entire Interview Prep Pro bundle (11 products) for $199 — save 30%.

Get the Complete Bundle →


Related Articles

Top comments (0)