System Design Building Blocks
The reusable components and techniques of every large system: scaling steps, load balancers, caches, consistent hashing, CAP, database choice, ID generation, queues, real-time communication, deployment and security fundamentals.
Every system design answer is assembled from the same parts. Each article here explains one building block: the problem it solves, how it works, the options and their trade-offs, the numbers worth remembering, and the interview questions it raises. The case studies combine them, each with an interactive Archify diagram. The Data-Intensive Systems section goes deeper into the theory behind the data-related blocks.
Scaling and traffic
- Scaling from Zero to Millions of Users
- Load Balancing and Proxies
- Caching Strategies
- Consistent Hashing
Data
- CAP Theorem and PACELC
- Choosing a Database: SQL, NoSQL and Storage Types
- Unique ID Generation
- Probabilistic Data Structures: Bloom Filters, HyperLogLog and Count-Min Sketch
Communication
- Message Queues and Delivery Semantics
- Long Polling, WebSockets and Server-Sent Events
- DNS and What Happens When You Type a URL
Operations and security
Articles
- Scaling to millions of usersThe step-by-step evolution of a web system from one server to millions of users: separating the database, vertical versus horizontal scaling, load balancers, database replication, caching, CDNs, stateless web tiers, multiple data centres, message queues, observability and sharding — with what each step fixes and costs.
- Load balancing and proxiesHow traffic is spread across servers: where load balancers sit, layer 4 versus layer 7, algorithms (round robin, weighted, least connections, least response time, IP hash, consistent hashing), health checks, smart clients versus hardware and software balancers like HAProxy, redundant balancers, and forward versus reverse proxies.
- Caching strategiesWhere to cache (client, CDN, application, distributed cache, database), read strategies (cache-aside, read-through) and write strategies (write-through, write-around, write-back), invalidation and TTLs, eviction policies, cache penetration with Bloom filters, stampedes and avalanches, Redis versus Memcached, and why Redis is fast.
- Consistent hashingWhy hash mod N breaks when servers change, how consistent hashing places servers and keys on a ring so only a fraction of keys move, virtual nodes for balance, replication along the ring, rendezvous hashing and jump hash, a Java TreeMap implementation, and where consistent hashing is used.
- CAP and PACELCWhat the CAP theorem actually says (and what it does not), why 'pick two of three' is misleading, CP versus AP systems during a partition, the latency-consistency trade-off that PACELC adds for normal operation, tunable consistency, and how to use these ideas in a system design discussion.
- Choosing a databaseA decision guide for data stores: relational versus the NoSQL families (key-value, document, wide-column, graph), time-series, search and in-memory stores, reasons to choose SQL or NoSQL, polyglot persistence, the role of indexes, and block versus file versus object storage.
- Unique ID generationGenerating unique identifiers at scale: requirements (unique, sortable, 64-bit, fast), database auto-increment and multi-master step, UUID v4 and v7, ticket servers and range allocation, and Twitter's Snowflake layout with timestamp, machine and sequence bits — clock rollback handling and a Java implementation.
- Queues and delivery semanticsWhy systems put queues between components, point-to-point queues versus publish-subscribe topics, message queues versus event streaming platforms, at-most-once, at-least-once and exactly-once delivery with idempotent consumers, ordering, dead-letter queues, back-pressure, and why Kafka is fast (sequential I/O and zero copy).
- Real-time communicationHow servers push data to clients over HTTP: short polling, long polling (hanging GET), WebSockets for full-duplex communication, and Server-Sent Events for one-way streams — how each works, overhead, scaling stateful connections, fallbacks, and Spring support.
- Deployment strategiesReducing the risk of releasing software: big-bang multi-service deployment, rolling updates, blue-green switches, canary releases with automated analysis, A/B testing, shadow traffic and feature flags — cost, rollback speed and risk compared, plus database changes and backward compatibility during deployments.
- Security fundamentalsThree security building blocks every system design needs: how HTTPS and TLS work (handshake, certificates, why it switches from asymmetric to symmetric encryption), how to store passwords safely (salts, slow adaptive hashing with bcrypt, scrypt and Argon2), and securing API access with tokens or HMAC request signatures.
- DNS and the request lifecycleThe full journey of a web request: URL parsing, browser and OS caches, recursive DNS resolution through root, TLD and authoritative servers, record types and TTLs, DNS-based load balancing and GeoDNS, TCP and TLS handshakes, HTTP/1.1 versus HTTP/2 versus HTTP/3, CDNs, and how the browser renders the page.
- Probabilistic data structuresAnswering membership, counting and frequency questions over huge data sets in tiny, fixed memory by accepting small, bounded errors: Bloom filters (and counting and cuckoo filters), HyperLogLog for distinct counts, Count-Min Sketch for heavy hitters, and where each appears in system design — with formulas and Java code.