Scalability — Motivation When a backend receives more traffic than it can handle, users experience slow responses, timeouts, or outages. Scalability is the set of techniques that let a system…
Availability — Goal: Build a simple two‑instance Node.js service behind NGINX with health checks, then simulate a failure.
Reliability — Motivation In a distributed backend, requests rarely travel a clean, uninterrupted path. Network glitches, temporary database outages, rate limits, or downstream service hiccups…
Fault tolerance — Motivation In a distributed backend, components (services, databases, message queues, etc.) can fail for many reasons: hardware crashes, network partitions, software bugs, or…
Horizontal scaling — Horizontal scaling—adding more machines (or containers) that share the load—addresses all of the above. It lets you add capacity by deploying more instances, isolate failures to a…
Vertical scaling — Motivation In a backend system you often start with a single server that runs all your services. As traffic grows, that one machine can become a bottleneck: CPU, memory, disk I/O…
Load balancing — Motivation When a web service receives more traffic than a single server can handle, requests start queuing, latency rises, and the server can crash. Load balancing distributes…
Reverse proxies — Motivation When a client talks to a backend service, the client usually talks to a single endpoint (e.g., api.example.com). In reality, that endpoint is often a gateway that hides…
API gateways — Why it matters If you expose every micro‑service directly, you lose control over traffic routing, rate limiting, authentication, and monitoring. It also makes it hard to evolve…
Service discovery — Motivation When a micro‑service architecture grows, services are deployed on many hosts, containers, or cloud instances. Each instance has its own IP address and port, and these…
Health checks — Health checks are lightweight probes that let a system (or an orchestrator) determine whether a service is running, reachable, and able to perform its core responsibilities. They…
Failover — Motivation In a production backend you rarely have a single point of truth. Services, databases, caches, and message brokers all run on multiple machines or containers. If any of…
Replication — Without replication, a backend would be a single point of failure, would struggle to serve many concurrent reads, and would be vulnerable to data loss.
Partitioning — Motivation When a backend grows, a single database instance or a single table can become a bottleneck. Queries that scan large tables, write bursts, or high concurrency can…
Sharding — Motivation When a single database instance cannot keep up with the volume of data or traffic, you need a way to split the workload. Sharding is the technique of partitioning a…
CAP Theorem — Imagine a library that has many copies of a book spread across cities.
PACELC — In a distributed system, data is spread across multiple nodes. When a network partition occurs (some nodes become unreachable), the system must decide how to behave. The PACELC…
Consistency vs Availability — Below is a Node.js example using Redis with quorum logic for writes and reads. We’ll use ioredis for cluster support.
Distributed systems — Motivation In a single‑box application, all state lives in one process. When traffic grows, that process becomes a bottleneck: CPU, memory, disk, or network limits. A distributed…
High‑level design of WhatsApp — WhatsApp is a global instant‑messaging platform that must deliver messages, media, and presence information to millions of users with low latency, high reliability, and end‑to‑end…
High‑Level Design of Netflix — Motivation A streaming platform like Netflix must deliver video content to millions of users worldwide with minimal latency, high reliability, and personalized experiences. The…
High‑Level Design of Uber — Motivation A ride‑hailing app must connect riders with nearby drivers in real time, calculate fares, handle payments, and provide a reliable, scalable experience for millions of…
High‑level design of Instagram — The core problem is: How do you deliver a highly personalized, low‑latency feed to millions of users while keeping writes fast, reads fast, and the system cost‑effective?
High‑level design of Amazon — Motivation Amazon is a global e‑commerce platform that must serve millions of users, process thousands of orders per second, and keep product data up‑to‑date across thousands of…