Tagged “System-Design”
34 articles with this tag.
- 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.
- 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.
- 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.
- 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.
- Chat SystemA one-to-one and group chat system designed with the 18-step framework: WebSocket gateways and a session registry, message IDs and per-chat ordering, store-then-fan-out delivery, offline sync and push notifications, delivery receipts, presence, media, end-to-end encryption, and storing trillions of messages in a wide-column store.
- Distributed Key-Value StoreA highly available key-value store designed from first principles: consistent hashing with virtual nodes, replication to N nodes, tunable quorums (W + R > N), vector clocks and conflict resolution, sloppy quorums and hinted handoff, gossip membership, Merkle-tree anti-entropy, and an LSM-tree storage engine.
- Flash SaleA system for limited-stock sales that attract millions of users at the same second, designed with the 18-step framework: shielding the core with CDNs, waiting rooms and rate limits, atomic stock reservation in Redis, asynchronous order creation through a queue, reservation expiry, preventing overselling and bots, and keeping the user experience honest.
- Metrics and AlertingA Prometheus-style monitoring platform designed with the 18-step framework: the metrics data model and cardinality, pull versus push collection, Kafka buffering, time-series storage with compression and downsampling, query engines, rule evaluation, alert routing, deduplication and silencing, and SLO burn-rate alerts.
- News FeedA social news feed designed with the 18-step framework: fan-out on write versus fan-out on read, the hybrid approach for celebrities, timeline caches of post IDs in Redis, hydration and ranking, cursor pagination, media, and the numbers behind each decision.
- Notification ServiceA multi-channel notification system (push, SMS, email, in-app) designed with the 18-step framework: event intake with idempotency, user preferences and quiet hours, templates and localisation, per-channel queues and workers, provider integration, retries and dead letters, rate limiting, delivery tracking and the decision flow that suppresses unwanted notifications.
- Payment SystemA payment system designed with the 18-step framework: pay-in and pay-out flows, payment service, executor, PSP integration with hosted payment pages, wallet and double-entry ledger, exactly-once execution through retries plus idempotency keys, handling unknown outcomes, reconciliation with settlement files, clearing and settlement, and payment security.
- Proximity ServiceDesigning 'find restaurants near me' with the 18-step framework: requirements and estimates, why latitude and longitude range queries are slow, geohash (prefixes, precision, boundary issues, neighbours), quadtrees built in memory, Google S2, a read-heavy architecture with a business service and location-based service, and why read replicas beat sharding here.
- Rate LimiterA distributed rate limiter designed with the 18-step framework: where to place it, token bucket, leaky bucket, fixed window, sliding log and sliding window counter algorithms compared, atomic Redis implementation with Lua, race conditions, multi-region synchronisation, HTTP 429 and rate-limit headers, and failure modes.
- Ride SharingA ride-hailing platform designed with the 18-step framework: ingesting millions of driver location updates, an in-memory geospatial index with H3 hexagonal cells, the dispatch flow from request to offer and acceptance, the trip state machine, ETA and surge pricing, consistency for driver assignment, and regional sharding.
- Stock ExchangeAn exchange designed for microsecond latency with the 18-step framework: the critical path from gateway to matching engine, order books with price-time priority, a sequencer and event journal for determinism, single-threaded in-memory matching (the LMAX architecture and Disruptor), market data distribution, hot-warm failover and why ordinary web architecture does not apply.
- URL ShortenerA complete URL shortener design using the 18-step framework: requirements, capacity calculations, API, base62 short codes from a unique ID versus hashing, 301 versus 302 redirects, a read-heavy architecture with caching, key-value storage, analytics through a queue, abuse prevention and trade-offs.
- Video StreamingA video platform designed with the 18-step framework: resumable uploads, a parallel transcoding DAG producing a bitrate ladder, HLS and DASH segments and manifests, adaptive bitrate playback, CDN and ISP-embedded caches like Netflix Open Connect, metadata and view counting, cost control and failure handling.
- Web CrawlerA distributed web crawler designed with the 18-step framework: the URL frontier with priority and per-host politeness queues, robots.txt, DNS caching, fetchers, parsing, URL normalisation and Bloom-filter deduplication, near-duplicate detection with SimHash, crawler traps, recrawl scheduling and storage.
- Order Management SystemA complete system design for an e-commerce order management system using the 18-step framework: requirements, labelled assumptions and capacity calculations, API, data model, architecture, saga with transactional outbox, idempotent payments, failure handling, scaling and trade-offs — including when a modular monolith is the better choice.
- Collaborative EditingA real-time collaborative document editor designed with the 18-step framework: why naive last-write-wins fails, operational transformation with a central server and revision log, CRDTs as the peer-to-peer alternative, WebSocket sessions per document, presence and cursors, snapshots, offline edits, permissions and scaling by document.
- File Storage and SyncA cloud file storage and synchronisation service designed with the 18-step framework: chunking and content-addressed block storage, deduplication and delta sync, separating metadata from blocks, strongly consistent metadata, presigned uploads, change notification with cursors, conflict handling, sharing and versioning.
- Search AutocompleteA typeahead suggestion system designed with the 18-step framework: tries with top-k results cached at every node, an offline data-collection and trie-building pipeline, serving from in-memory shards, browser caching and request debouncing, personalisation, filtering and trending queries.
- Diagram Building BlocksA library of reusable Mermaid diagrams for system design — load balancer, API gateway, services, databases, caches, message brokers, object storage, search indexes, external services, replication, sharding and event flows — each with its responsibility, failure modes and trade-offs.
- 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.
- 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.
- IntroductionA repeatable 18-step framework for designing systems and answering system design interviews: requirements, capacity estimation with worked calculations, APIs, data models, architecture, scaling, failure handling and trade-offs.
- 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.
- 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.
- 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).
- 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.
- Reliability, scalability, maintainabilityThe three goals of every data system, made measurable: faults versus failures, hardware, software and human errors; describing load with parameters such as fan-out; measuring performance with percentiles and tail latency; vertical versus horizontal scaling; and operability, simplicity and evolvability.
- 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.
- 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.