Chapter 12 of 12
Course Progress0 of 12 completed (0%)

Modern System Design & API Architecture · Chapter 12 · ~35 min · Senior & Staff Capstone

System Design Capstone: Technical Interview Framework & Scalable Architectures

The definitive interview guide for Senior and Staff Distributed Systems Architects. Master the formal 45-minute FAANG System Design Interview Framework, capacity estimations, back-of-the-envelope calculations, and architectural trade-offs across all 12 course chapters.

  • 12 Deep Technical System Design Questions spanning Chapters 1 through 11
  • 45-Minute FAANG System Design Interview Blueprint (5 Phases)
  • Back-of-the-Envelope Capacity Estimations & Latency Numbers Reference
  • Interactive Architect Studio: TinyURL (100k QPS) & WhatsApp (50M Sockets)

System Design Capstone & Technical Interview: URL Shortener & Global Chat: learn it visually

Put theory into practice with two end-to-end system designs: high-throughput Base62 TinyURL generation with Redis caching, and low-latency global WebSocket chat over Redis Pub/Sub and Cassandra.

System Design Capstone & Technical Interview: URL Shortener & Global ChatPut theory into practice with two end-to-end system designs: high-throughput Base62 TinyURL generation with Redis caching, and low-latency global WebSocket chat over Redis Pub/Sub and Cassandra.UNDERSTANDAccept a requestFOLLOW THE FLOWScale the servicesAPPLY ITDeliver the resultSystem Design Capstone & Technical Interview: URL Shortener & Global ChatPut theory into practice with two end-to-end system designs: high-throughput Base62 TinyURL generation with Redis caching, and low-latency global WebSocket chat over Redis Pub/Sub and Cassandra.UNDERSTANDAccept a requestFOLLOW THE FLOWScale the servicesAPPLY ITDeliver the result

1The 45-Minute FAANG System Design Blueprint

In a senior or staff system design interview at Google, Meta, Amazon, or Stripe, you are evaluated on structure, communication, and trade-off defense under severe 45-minute time constraints. Never jump straight to drawing databases on the whiteboard. Follow the 5-Phase Cadence:

Phase 1 (0–5m)
Scope & SLA

Clarify functional requirements (core features) vs non-functional (DAU, latency SLA, read/write ratio, CAP priorities).

Phase 2 (5–10m)
Capacity Math

Back-of-the-envelope estimations: QPS (reads vs writes), ingress/egress bandwidth, and 5-year storage projections.

Phase 3 (10–20m)
High-Level API

Define REST/gRPC endpoint contracts and data schemas. Sketch the end-to-end client-to-storage data flow.

Phase 4 (20–35m)
Deep Dive

Dive into critical bottlenecks: caching tiers (Redis/CDN), message queues (Kafka), partition keys, and replication.

Phase 5 (35–45m)
Resilience & SPOF

Eliminate single points of failure (SPOFs), configure circuit breakers, rate limiters, multi-region failover, and disaster recovery.

Back-of-the-Envelope Estimation Reference (Powers of 10):
Mental Math Cheatsheet
Daily Seconds:1 Day ≈ 86,400s ≈ 10⁵ s100M daily requests ≈ 1,200 QPS
Storage Scaling:1KB × 100M/day = 100 GB/day100 GB/day ≈ 36.5 TB/year
Latency Scale:L1 Cache: 0.5ns | RAM: 100nsNVMe SSD: 100µs | Cross-DC: 50ms

Wrong idea: Hash the URL with MD5 and truncate the first 7 characters

MD5(url)[:7] → Collision detected after 100k URLs → Expensive DB loop retry storm!Flaw: Cryptographic hashes cannot prevent collisions when truncated to small string lengths

Relying on truncated cryptographic hashes to generate short URL keys without accounting for the Birthday Paradox collision rate.

Real system: Distributed Snowflake/KGS 64-bit integer encoded with Base62

Integer ID: 125,193,428 → Base62 Bijective Mapping → "8mZ1q" (100% collision-free)Bijective: Pure O(1) mathematical bijection with zero collision checks or DB retries

Generate a globally unique 64-bit integer counter via distributed Key Generation Service (KGS) and convert to Base62 [0-9a-zA-Z]. 7 characters yields 3.5 trillion collision-free URLs.

2Enterprise Architect Studio: TinyURL & WhatsApp Simulations

Explore the interactive systems below to visualize high-throughput request paths, Key Generation Service (KGS) counter leasing, and real-time WebSocket multiplexing across Redis Pub/Sub:

End-to-End System Design Architect Studio

System Topology: Distributed URL Shortener (100:1 Read-Heavy)

Client → Anycast DNS → Cloudflare Edge CDN → NGINX API Gateway → Redis Cache Cluster → Key Generation Service (KGS) → Sharded PostgreSQL.

KGS Atomic Counter:ID #124982Lease: 1,000 keys per pod
Test Live HTTP Redirect Resolution (GET /:shortCode):
https://short.io/
Sharded URL Metadata Store & Cache Status:
64-bit idshortcodedestination urltierclicks
124980/8mZ1nhttps://stripe.com/docs/api/idempotent_requests
Redis Hot Tier
1,420
124981/8mZ1ohttps://aws.amazon.com/well-architected-framework
Redis Hot Tier
890
Architect Studio Trace & Diagnostic Log:
›System Architect Studio initialized in multi-region simulation mode.
›TinyURL KGS node [kgs-worker-01] leased integer range [124980 - 125999].

3Category-Filtered System Design Questions Bank

Filter interview questions across core distributed system design domains. Review rubric criteria, deep model architecture explanations, and critical candidate traps to avoid:

System Design Interview Question

When would you choose gRPC over REST with JSON for inter-service communication, and why cannot standard web browsers communicate with gRPC backend servers directly?

What the Interviewer Evaluates:
  • Protobuf binary serialization: 5-10x smaller payload size and faster CPU deserialization than JSON.
  • HTTP/2 multiplexing, header compression (HPACK), and bi-directional streaming over a single TCP connection.
  • Browser limitations: browser JavaScript APIs (fetch, XMLHttpRequest) cannot directly manipulate raw HTTP/2 framing or trailers, requiring gRPC-Web proxies (e.g. Envoy).
Model Architecture & Technical Explanation:
1. Why Choose gRPC for Microservices: - Binary Serialization: Protocol Buffers (Protobuf) serializes strongly-typed binary payloads that are 5x to 10x more compact than text JSON, reducing bandwidth and slashing CPU serialization latency. - HTTP/2 Multiplexing: Multiple concurrent RPC calls execute in parallel over a single persistent TCP connection, eliminating head-of-line blocking and repeated handshake overhead. - Code Generation & Schema Enforcement: `.proto` IDL files compile deterministically into client stubs and server interfaces across polyglot microservices (Go, Java, Python, Rust). 2. Why Standard Browsers Cannot Call Native gRPC Directly: - Browser Sandbox: Web browser networking APIs (`fetch()`, `XMLHttpRequest`) operate at a high abstraction layer and do not expose fine-grained control over raw HTTP/2 frames. - HTTP/2 Trailers: gRPC sends RPC status codes (`grpc-status`, `grpc-message`) inside HTTP/2 trailing headers (frames sent after the response body data). Standard browser fetch implementations cannot intercept trailing headers reliably. - Solution: Frontend web clients communicate via REST/JSON or connect to an Envoy / gRPC-Web proxy that bridges HTTP/1.1 or standard HTTP/2 to native gRPC backend services.
Common Candidate Trap to Avoid:

Saying 'gRPC is always faster than REST for everything including mobile web browsers'. Without gRPC-Web proxying, web browsers cannot establish native gRPC connections.

4Hands-On Challenge: Base62 URL Bijective Encoder & Decoder

A Key Generation Service (KGS) utilizes a Base62 encoder to transform positive 64-bit integer counters into collision-free shortcodes. However, the implementation contains three fatal algorithmic defects: failing to handle the 0 boundary, performing float division instead of integer floor division (corrupting subsequent character calculations), and inverting the polynomial accumulator logic in the decoder.

Fix the encoder and decoder implementation below, then click Run & verify:

Python Base62 URL Shortener Bug Hunt · Bijective Encoding
Python

🎯 Find and fix the bugs in the code above, then press Run & verify to test your solution.

Need a hint?
  • Handle 0 boundary: return BASE62_ALPHABET[0] when num == 0.
  • Floor division: replace num = num / base with integer floor division num = num // base.
  • Fix Horner decode polynomial accumulator: calculate num = (num * base) + idx.
Concept Check 1 of 2
1

Why is Base62 (0-9, a-z, A-Z) preferred over Base64 for URL shortener shortcodes?

Concept Check 2 of 2
2

Why is Apache Cassandra (or ScyllaDB) structurally superior to PostgreSQL for storing trillions of chat messages?

5Course Graduation & Career Next Steps

Congratulations! You've Completed System Design & API Architecture

You have mastered the complete 12-chapter curriculum: from request lifecycles, load balancing, and API paradigms (REST, GraphQL, gRPC), to multi-tier caching, database sharding, asynchronous message queues, rate limiters, circuit breakers, and planetary-scale microservices.

Ready to claim your graduation milestone?

Enjoying this free lesson? Your support helps us build more free animated chapters.

Support Us