Architecture — System Design Concepts

Architecture — System Design Concepts

Overview

30 core building blocks of scalable system design, grouped by concern. Understanding these makes system behaviour predictable — each concept naturally forces the next question, building a mental model of how production systems work.


Foundation — Networking & Communication

ConceptCore idea
Client–ServerClient sends request → server processes → response. Every web app is this loop.
IP AddressUnique address per server. Clients need it to reach a server.
DNSMaps human-readable domain → IP address. Like a phone book.
ProxyMiddleman on the client side — hides client IP, used in VPNs.
Reverse ProxyMiddleman on the server side — hides server IP, controls/filters incoming traffic.
LatencyRound-trip time. Reduced by deploying servers geographically closer to users.
HTTP / HTTPSHTTP = transport protocol (plain text). HTTPS adds SSL/TLS encryption. HTTP defines how data moves, not what it means.

APIs & Data Formats

ConceptCore idea
APIsAbstraction layer between client and server. Client asks for data → gets structured response (usually JSON). Doesn’t need to know internal logic.
REST APIStateless, resource-based HTTP API. Standard verbs: GET/POST/PUT/PATCH/DELETE. Problem: fixed responses can over- or under-fetch data.
GraphQLClient specifies exactly what fields it wants. One request instead of multiple REST calls. Server returns exactly that structure.
WebSocketsPersistent bidirectional connection. Eliminates polling for real-time use cases: chat, dashboards, gaming.
WebhooksServer-to-server event notification. Provider calls your URL when an event happens. “Don’t call me, I’ll call you.”

Storage & Data Management

ConceptCore idea
DatabasesPersistent, reliable storage. Client → Server → DB → Server → Client.
SQL vs NoSQLSQL: structured, ACID, joins — good for consistency (banking, orders). NoSQL: flexible, scalable — good for speed/volume (recommendations, logs). Modern systems use both.
Database IndexingPointer structure on a column → skips full table scan. Speeds up reads; slightly slows writes. Index columns used frequently in WHERE clauses.
ReplicationPrimary DB handles writes; read replicas share read load. Replicas can be promoted if primary fails. Write bottleneck remains.
Sharding (Horizontal Partitioning)Split data by rows across servers using a shard key (user ID, region). Each shard handles a subset. Reduces per-server load.
Vertical PartitioningSplit a wide table by columns into focused sub-tables. Faster queries because less data scanned per request.
DenormalizationCombine related data into fewer tables to eliminate JOINs. Trades storage duplication for faster reads. Best for read-heavy systems.
Blob StorageStore large unstructured files (images, video, PDFs) in object storage (S3, Azure Blob). Unique URL per file, petabyte scale, cost-per-byte.

Scaling & Performance

ConceptCore idea
Vertical ScalingUpgrade single machine (more CPU/RAM). Simple but has hardware ceiling and creates a single point of failure.
Horizontal ScalingAdd more machines. Traffic distributed across them. No SPOF; cost-effective; unlimited ceiling. Requires a load balancer.
Load BalancersSit between clients and servers; distribute traffic. Algorithms: Round Robin (even order), Least Connections (busy-aware), IP Hashing (session affinity).
CachingStore hot data in memory (Redis, Memcached) to avoid DB round-trips. Cache-Aside: check cache → miss → query DB → populate cache. TTL prevents stale data.
CDNEdge servers worldwide cache static assets. User’s request hits nearest server → lower latency. Used by Netflix, YouTube. Works with Blob Storage.

Distributed Systems

ConceptCore idea
CAP TheoremIn distributed systems you can only guarantee 2 of 3: Consistency (latest data), Availability (always responds), Partition Tolerance (survives network split). P is non-negotiable → choose CP or AP. CP: SQL (correct, sometimes unavailable). AP: Cassandra/DynamoDB (available, eventually consistent).
MicroservicesSplit monolith into single-responsibility services with their own data stores. Independent scaling, safer deploys, fault isolation. Adds coordination complexity.
Message QueuesAsync inter-service communication via queue (Kafka, RabbitMQ, SQS). Producer → queue → consumer. Decouples services, handles traffic spikes, tolerates consumer downtime.
Rate LimitingCap requests per client per time window. Algorithms: Fixed Window, Sliding Window, Token Bucket. Returns HTTP 429 when exceeded. Typically handled by API Gateway.
API GatewaySingle entry point to all microservices. Handles auth, rate limiting, routing, logging centrally. Clients don’t need to know service topology.
IdempotencyMultiple identical requests → same result as one. Use unique request IDs + deduplication check before processing. Critical for payments, bookings, retries.

Quick Mental Model

1
2
3
4
5
6
Client → DNS → IP → Proxy/Reverse Proxy
       → Load Balancer → App Servers (horizontal)
       → API Gateway → Microservices
       → Cache (Redis) → Database (SQL/NoSQL)
       → Blob Storage / CDN (static assets)
       → Message Queue (async work)

Failures in distributed systems are inevitable → design for: replication (DB), sharding (data size), caching (latency), rate limiting (abuse), idempotency (retries), CAP trade-offs (consistency vs availability).


See Also

Trending Tags