Check your interview readinessStart Tech Assessment

System Design Fundamentals

The building blocks - load balancing, caching, sharding, queues, consistency - explained with diagrams.

13 min readUpdated Jul 2026By the TopCoding team

System design interviews feel intimidating because they're open-ended - there's no single right answer. But every design is assembled from a small set of reusable building blocks. Learn the blocks and the trade-offs between them, and any prompt becomes a matter of composition.

~8
Core building blocks behind almost every design
3
Levers that dominate: latency, throughput, consistency
L5+
Level at which system design becomes make-or-break

What system design tests

The interviewer isn't checking whether you've memorised an architecture. They're watching how you handle ambiguity: do you ask about scale before drawing boxes? Do you name trade-offs instead of pretending there's a free lunch? Do you know where the bottleneck will be? The building blocks below are the vocabulary you use to show it.

A structure that works for any prompt
Requirements & scale → API & data model → high-level diagram → deep-dive on the bottleneck → address failures & scale. Anchor every answer to this and you'll never freeze. The System Design Interview Questions guide applies it to real prompts.

Anatomy of a request

Almost every web system is a variation on this path: a client hits a load balancer, which spreads traffic across stateless app servers, which read from a cache first and fall back to a database that replicates for read scale. Master this skeleton and you can grow any design from it.

Clientweb / mobileLoad balancerroutes trafficApp serverApp serverApp serverCacheRedisDatabaseprimaryReplicaread copies
The canonical request path. Most system-design answers start here and then deep-dive on whichever box becomes the bottleneck at the required scale.

Scaling: vertical vs horizontal

When load grows you have two options: a bigger machine (vertical) or more machines (horizontal). Vertical is simple but has a hard ceiling and a single point of failure. Horizontal scales almost without limit but forces your servers to be stateless and introduces coordination problems.

Vertical (scale up)Horizontal (scale out)
HowBigger CPU / RAM / diskAdd more machines behind a load balancer
CeilingHardware limitPractically unlimited
FailureSingle point of failureTolerates node loss
CostCheap early, steep laterLinear, predictable
CatchSimpleRequires stateless services + coordination

Caching

Caching is the highest-leverage optimisation in most systems: keep frequently-read data in fast memory so you don't recompute or re-fetch it. The hard part is never the cache - it's invalidation and staleness.

Where
Layers
Browser, CDN, application (Redis / Memcached), and database query cache - each closer layer is faster but smaller.
Policy
Eviction
LRU is the default. Size the cache to your hot set, not your whole dataset.
Risk
Staleness
Write-through, write-back and TTLs trade freshness for speed. Decide how stale is acceptable per use case.
Cache invalidation
"There are only two hard things in computer science: cache invalidation and naming things." In an interview, proactively say how you keep the cache correct - it's a classic follow-up.

Databases, sharding & replication

Two independent decisions: replication (copies of the data for read scale and failover) and sharding (splitting the data across machines for write scale and size). And, upstream of both, the SQL-vs-NoSQL choice.

  • Replication - a primary takes writes; read replicas serve reads. Great for read-heavy systems; introduces replication lag (eventual consistency on the replicas).
  • Sharding - partition rows across machines by a shard key (e.g. user id). Scales writes and storage; makes cross-shard queries and re-balancing hard. Choose the shard key carefully to avoid hot spots.
  • SQL vs NoSQL - SQL for strong consistency, relations and transactions; NoSQL for massive scale, flexible schemas and simple access patterns. Justify the choice from the requirements, never by fashion.

Queues & async processing

Not everything needs to happen inside the request. A message queue (Kafka, SQS, RabbitMQ) lets you accept work fast and process it later, smoothing traffic spikes and decoupling services so a slow consumer can't take the whole system down.

Smooth spikes
Absorb bursts by buffering work and letting consumers drain the queue at their own pace instead of overloading.
Decouple services
Producers and consumers scale and fail independently - the backbone of resilient, event-driven architectures.

Consistency & CAP

The CAP theorem says that when the network partitions (and it will), a distributed system must choose between consistency (every read sees the latest write) and availability (every request gets a response). You can't have both during a partition - so you choose per use case.

ChoiceBehaviourGood for
CP - consistencyRejects/blocks rather than serve stale dataPayments, inventory, bookings
AP - availabilityAlways answers, may be briefly staleFeeds, likes, presence, analytics
Eventual consistency isn't a bug
Most large consumer systems are AP and eventually consistent by design - a like count that's off for two seconds is fine. Name the guarantee you need for the specific feature; don't default to strong everywhere.

The full building-block map

The blocks above cover most interviews, but the full landscape is broader. This is the map we teach at TopCoding - nine modules from fundamentals to observability - so you can see where each concept fits and what to study next.

01
Fundamentals
Client-server, APIs, latency vs throughput, back-of-the-envelope estimation.
02
Data consistency
CAP, ACID vs BASE, transactions, isolation levels.
03
Distributed systems
Consensus, leader election, distributed transactions, clocks.
04
Networking
DNS, HTTP, TLS, load balancing, CDNs, API gateways.
05
Async processing
Message queues, pub/sub, event-driven design, idempotency.
06
Performance
Caching layers, indexing, connection pooling, profiling.
07
Scalability
Horizontal scaling, sharding, partitioning, statelessness.
08
Fault tolerance
Replication, failover, retries, circuit breakers, backpressure.
09
Observability
Metrics, logging, tracing, alerting, SLOs.
Turn the map into a plan
Reading the blocks isn't the same as designing under pressure. TopCoding runs this curriculum one-on-one with senior engineers, then pressure-tests it in mock design interviews - book a free call to build your plan.

Sources & further reading

  1. 1Designing Data-Intensive ApplicationsMartin Kleppmann
  2. 2The System Design PrimerGitHub (donnemartin)
  3. 3CAP Theorem, twelve years laterEric Brewer / InfoQ
  4. 4AWS Well-Architected FrameworkAmazon Web Services