System Design

Definition

System design is the process of defining the architecture, components, modules, interfaces, and data flows for a system that satisfies specified requirements. In the engineering career context, it is a key interview domain testing the ability to reason about trade-offs at scale.


Core Ideas

Design Principles

  • Scalability — handle growing load by scaling horizontally (more machines) or vertically (bigger machines)
  • Reliability — continue operating correctly despite failures; measured as uptime / SLA
  • Availability — proportion of time the system is operational (99.9% = ~8.7h downtime/year)
  • Consistency — every read sees the most recent write (strong) or eventually (eventual)
  • CAP Theorem — a distributed system can guarantee at most two of: Consistency, Availability, Partition Tolerance
  • Latency vs Throughput — optimise for response time OR requests-per-second; rarely both

Common Components

ComponentExamplesPurpose
Load BalancerAWS ALB, NGINXDistribute traffic across servers
CacheRedis, Memcached, CDNReduce latency, reduce DB load
DatabasePostgreSQL, DynamoDBPersistent storage
Message QueueSQS, KafkaAsync decoupling, backpressure
CDNCloudFront, CloudflareEdge-cached static/dynamic content
SearchElasticsearch, OpenSearchFull-text and vector search

Caching Strategies

  • Cache-aside (lazy loading) — app checks cache, misses → fetch DB → populate cache
  • Write-through — write to cache and DB simultaneously
  • Write-behind — write to cache; async flush to DB (risk: data loss)
  • TTL — time-based expiry; balance freshness vs hit rate

Database Design

  • Normalisation vs denormalisation — 3NF for consistency; denormalise for read performance
  • Sharding — horizontal partitioning across multiple DB instances (by user ID, geography)
  • Replication — primary + read replicas for read scaling; failover for reliability
  • SQL vs NoSQL — relational for structured/consistent data; NoSQL for flexible schema, scale

Interview Framework (RESHADED)

  1. Requirements — clarify functional and non-functional (scale, latency, availability)
  2. Estimation — back-of-envelope calculations (QPS, storage, bandwidth)
  3. System API — define the interface
  4. High-level design — draw boxes and arrows; major components
  5. Architecture deep-dive — focus on the hardest parts
  6. Data model — schema design, DB choice
  7. Edge cases — bottlenecks, failure modes, trade-offs
  8. Deep dive on bottleneck — go deep on one hard part

Interview Conduct (as distinct from framework)

A framework tells you what to cover; these are about how to behave while covering it:

  • Start from the basics, then add cache and load balancer — don’t open with the complex design.
  • Ask questions back, many of them: how many DAU? how many writes per day? does it need like/dislike? what’s the latency threshold? do you want code written?
  • Stay at the concept level and let the interviewer drive. Say “relational vs non-relational”, not “Postgres” — commit to specifics only when asked.
  • Name the trade-offs explicitly — e.g. sharding by id vs by table.
  • Don’t memorize questions. Pattern-matching a rehearsed answer is visible and fails on variants.
  • Don’t argue with the interviewer, even when they’re wrong. Take feedback humbly.

The asymmetry worth internalizing: the framework is table stakes, and the conduct is what actually differentiates — most candidates fail by designing too much too early and by not asking.


Relationships


References

  • What Every Developer Should Learn Early On - Stack
  • System Design Tips — HackBear interview-conduct tips; also references Grokking the System Design Interview