Caching & Performance
Making systems fast — caching strategies, CDNs, rate limiting and low-latency design — with a capacity estimator and the systems that live or die on cache hit rates.
System Designs 11
Design a URL Shortener
Build a URL shortener (think Bitly or TinyURL) step by step. Learn how to mint unique short codes with base62, make the read-heavy redirect path sub-millisecond with caching, shard billions of mappings, and track clicks asynchronously through an interactive diagram that grows with each concept.
Design Twitter
Build Twitter's news feed step by step. Learn the social graph, why fan-out on write beats read-time merging, how a precomputed timeline cache makes feed reads O(1), how ranking surfaces the best tweets, and how a hybrid model solves the celebrity problem — through an interactive diagram that grows with each concept.
Design YouTube
Build a planet-scale video platform step by step. See how raw uploads become an adaptive-bitrate ladder through an async transcoding pipeline, how a CDN serves immutable segments from the edge, how tiered blob storage holds exabytes affordably, and how view counts stay async — through an interactive diagram that grows with each concept.
Design a Rate Limiter
Build a distributed rate limiter step by step. Learn where to put the check, how to key and tier limits, the token-bucket and sliding-window algorithms, why shared atomic counters in Redis avoid race conditions, and the fail-open vs fail-closed trade-off — through an interactive diagram that grows with each concept.
Design Typeahead (Autocomplete)
Build a search typeahead step by step. See how a prefix trie turns search into an O(L) walk, how a prefix-keyed cache answers the skewed common case in under a millisecond, how precomputed top-k ranking surfaces the best ten, how an offline builder keeps suggestions fresh from query logs, and how to personalize and shard — through an interactive diagram that grows with each concept.
Design a Distributed Cache
Build a distributed cache like Redis or Memcached step by step. See how cache-aside shields the database, how consistent hashing shards across nodes, how TTL and LRU/LFU eviction bound memory, how replication and invalidation keep it correct, and how to survive cache stampedes and hot keys — through an interactive diagram that grows with each concept.
Design a News Feed
Build a social news feed step by step. See how the social graph, pull vs push fan-out, a precomputed feed cache, relevance ranking, the hybrid model that tames the celebrity problem, blending multiple content sources, and cursor pagination fit together — through an interactive diagram that grows with each concept.
Design Netflix
Build a planet-scale video streaming service step by step. See how the play path splits authorization from byte delivery, how origin storage and CDN edges serve immutable segments, how an adaptive-bitrate ladder adapts to any connection, how a parallel transcoding pipeline builds it, and how Open Connect, recommendations and QoE events fit together — through an interactive diagram that grows with each concept.
Design Instagram
Build a photo-sharing app step by step. See how splitting media from metadata, a CDN for immutable images, async image processing, a precomputed feed cache, asynchronous like/view counters, TTL-based ephemeral stories, and sharding fit together to serve billions of photos — through an interactive diagram that grows with each concept.
Design Pastebin
Build a text-paste service step by step. See how base62 key generation, separating metadata from blob storage, a cache and CDN for the read-heavy immutable path, TTL expiration, privacy flags and size limits, and async analytics fit together — through an interactive diagram that grows with each concept.
Design a Stock Exchange
Build a stock exchange matching engine step by step. See how an in-memory order book with price-time priority matches orders, how pre-trade risk checks guard the core, how a single sequencer and single-threaded engine give deterministic low-latency matching, and how market-data feeds, journaling/replay, clearing and symbol partitioning fit together — through an interactive diagram that grows with each concept.