System design
- System design6 min read
Back-pressure
What back-pressure is and how systems use it to stay stable under load: fast producers and slow consumers, unbounded queues and memory exhaustion, bounded buffers, blocking, dropping and sampling, rejecting with 429 and 503, load shedding, back-pressure in TCP, Node.js streams, reactive streams and Kafka, and designing systems that degrade gracefully.
- System design6 min read
Caching layers in system design
Where caches live in a large system and what each layer is good for: browser, CDN, reverse proxy, application in-process, distributed caches like Redis, and the database's own caches, with hit rates, consistency, invalidation across layers, stampedes, hot keys, and how to discuss caching in interviews.
- System design5 min read
Circuit breakers
How the circuit breaker pattern stops one failing dependency from taking down a whole system: cascading failures, the closed, open and half-open states, thresholds and sliding windows, fallbacks, a working implementation, Resilience4j and service meshes, and how breakers combine with timeouts, retries and bulkheads.
- System design5 min read
Consistent hashing
Consistent hashing explained: why hash-mod-N breaks when servers change, the hash ring, how adding or removing a node moves only a small share of keys, virtual nodes for balance, replication, a working Python implementation, and where it is used in practice.
- System design5 min read
CQRS explained
Command Query Responsibility Segregation explained: separating the write model from read models, commands and queries, keeping read models up to date with events, eventual consistency in the user interface, how CQRS relates to event sourcing, a worked example, and when it is worth the complexity.
- System design6 min read
Design a chat app
A system design walkthrough of a chat application like WhatsApp or Slack: requirements and estimates, WebSocket connections and gateways, message flow and delivery receipts, message storage and IDs, group chats and fan-out, presence, offline users and push notifications, ordering, and scaling.
- System design7 min read
Design a rate limiter
A system design walkthrough of a rate limiter: requirements, where it runs, the fixed window, sliding log, sliding window counter, token bucket and leaky bucket algorithms with code, a distributed limiter on Redis with atomic Lua scripts, response headers, and failure handling.
- System design6 min read
Design a URL shortener
The classic system design interview question worked through end to end: requirements, traffic and storage estimates, the API, generating short codes with base62 and counters, the database, caching redirects, 301 versus 302, analytics, abuse prevention and scaling.
- System design5 min read
Event-driven architecture
Event-driven architecture explained: events versus commands, publishers and subscribers through a broker, choreography and orchestration, the outbox pattern, idempotent consumers, eventual consistency, event sourcing, and the trade-offs to weigh before adopting it.
- System design6 min read
Idempotency
Why idempotency matters whenever requests can be retried: what idempotent means, which HTTP methods are idempotent, idempotency keys for payments and orders with a working implementation, idempotent message consumers, database techniques, and the mistakes that cause double charges.
- System design5 min read
Kafka explained
How Apache Kafka works and why it is built as a log: topics, partitions and offsets, producers and keys, consumer groups and rebalancing, replication and acknowledgements, retention, and when Kafka is the right tool.
- System design6 min read
Leader election
How distributed systems pick one node to be in charge and replace it safely when it fails: why leaders are useful, leases and heartbeats, consensus with Raft, using etcd, ZooKeeper, Consul or Kubernetes leases instead of building your own, database-based locks, fencing tokens against split brain, and when to avoid needing a leader.
- System design5 min read
Message queues
Why systems pass work through queues: decoupling, absorbing bursts and doing slow work later. Producers, consumers and brokers, point-to-point vs publish-subscribe, delivery guarantees, acknowledgements and retries, dead-letter queues, ordering, and choosing a broker.
- System design4 min read
Microservices vs monolith
What a monolith and microservices really are, the costs and benefits of each, the modular monolith in between, how to decide for your team, and the warning signs that you split too early or too late.
- System design6 min read
Observability: logs, metrics and traces
What observability means and how its three signals work together: logs for detail, metrics for trends and alerts, distributed traces for following a request across services, OpenTelemetry for collecting all three, correlation between them, SLIs and SLOs, and designing systems you can debug in production.
- System design5 min read
Pagination done right
How to page through large result sets in APIs and databases: why offset pagination slows down and skips rows, keyset (cursor) pagination with stable ordering and opaque cursors, page size limits, total counts, infinite scroll versus numbered pages, and API response formats.
- System design4 min read
RabbitMQ explained
How RabbitMQ routes messages: producers, exchanges, bindings and queues, the four exchange types, acknowledgements, durability and prefetch, dead-lettering, a working Python example, and how RabbitMQ differs from Kafka.
- System design6 min read
Sagas and distributed transactions
How to keep data consistent when one business operation spans several services: why a single ACID transaction no longer works, two-phase commit and its problems, the saga pattern with compensating actions, choreography and orchestration, the outbox, idempotency, and designing for failure.
- System design5 min read
Scalability basics
What it means for a system to scale, vertical vs horizontal scaling, stateless servers and load balancers, caching, database read replicas and sharding, queues, and how to find the bottleneck before you fix the wrong thing.
- System design6 min read
Search autocomplete
Designing search autocomplete (typeahead): requirements and latency budget, tries and top-k suggestions per prefix, building suggestions offline from query logs, serving from memory with caching, sharding by prefix, debouncing and client caching, ranking, personalisation and freshness, typo tolerance, and filtering unsafe suggestions.