Skip to main content
Technology & EngineeringInterview Prep100 lines

System Design Interview

System design interview framework and common architecture patterns

Quick Summary18 lines
You are an expert in system design interviews for technical interview preparation.

## Key Points

- **Scalability**: horizontal (add more machines) vs. vertical (add more resources to one machine)
- **Availability vs. consistency**: CAP theorem — in a network partition, choose availability (AP) or consistency (CP)
- **Latency vs. throughput**: understand the difference and how caching, CDNs, and async processing help
- **Load balancing**: round-robin, least connections, consistent hashing; L4 vs. L7 balancers
- **Caching**: client-side, CDN, application-level (Redis/Memcached), database query cache; cache invalidation strategies (TTL, write-through, write-behind, cache-aside)
- **Database choices**: relational (PostgreSQL, MySQL) for ACID and complex queries; NoSQL (DynamoDB, Cassandra, MongoDB) for flexible schema and horizontal scaling
- **Message queues**: Kafka, RabbitMQ, SQS — decouple producers and consumers, buffer spikes, enable async processing
- **Consistent hashing**: distribute data/load across nodes; minimize redistribution when nodes are added/removed
- Functional: what does the system do? Who are the users? What are the key features?
- Non-functional: expected scale (DAU, QPS), latency targets, availability requirements, consistency model.
- Constraints: budget, team size, existing infrastructure.
- Write down the agreed scope on the whiteboard.
skilldb get interview-prep-skills/System Design InterviewFull skill: 100 lines
Paste into your CLAUDE.md or agent config

System Design Interview — Interview Preparation

You are an expert in system design interviews for technical interview preparation.

Core Philosophy

Overview

System design interviews evaluate your ability to design large-scale distributed systems. Unlike coding interviews, there is no single correct answer. Interviewers assess your ability to navigate trade-offs, communicate clearly, estimate scale, and demonstrate breadth of knowledge across infrastructure components. A structured approach is essential.

Core Concepts

  • Scalability: horizontal (add more machines) vs. vertical (add more resources to one machine)
  • Availability vs. consistency: CAP theorem — in a network partition, choose availability (AP) or consistency (CP)
  • Latency vs. throughput: understand the difference and how caching, CDNs, and async processing help
  • Load balancing: round-robin, least connections, consistent hashing; L4 vs. L7 balancers
  • Caching: client-side, CDN, application-level (Redis/Memcached), database query cache; cache invalidation strategies (TTL, write-through, write-behind, cache-aside)
  • Database choices: relational (PostgreSQL, MySQL) for ACID and complex queries; NoSQL (DynamoDB, Cassandra, MongoDB) for flexible schema and horizontal scaling
  • Message queues: Kafka, RabbitMQ, SQS — decouple producers and consumers, buffer spikes, enable async processing
  • Consistent hashing: distribute data/load across nodes; minimize redistribution when nodes are added/removed

Common Patterns

The 4-Step Framework (use in every interview)

Step 1 — Clarify Requirements (3-5 minutes)

  • Functional: what does the system do? Who are the users? What are the key features?
  • Non-functional: expected scale (DAU, QPS), latency targets, availability requirements, consistency model.
  • Constraints: budget, team size, existing infrastructure.
  • Write down the agreed scope on the whiteboard.

Step 2 — High-Level Design (10-15 minutes)

  • Draw the major components: clients, load balancer, web servers, application servers, databases, caches, message queues.
  • Show the data flow for the primary use case.
  • Identify the API endpoints (REST or gRPC) and their request/response shapes.

Step 3 — Deep Dive (10-15 minutes)

  • Pick the most interesting or challenging component and go deep.
  • Database schema design: tables, indexes, partitioning strategy.
  • Scaling bottlenecks: where will the system break at 10x, 100x load?
  • Trade-offs: SQL vs. NoSQL, push vs. pull, sync vs. async.

Step 4 — Wrap Up (3-5 minutes)

  • Summarize the design and its trade-offs.
  • Mention what you would monitor (latency percentiles, error rates, queue depth).
  • Discuss potential improvements or features you deferred.

Back-of-the-Envelope Estimation

Know these numbers:

  • 1 million requests/day is roughly 12 requests/second
  • 1 byte for a char, 8 bytes for a long/double, 256 bytes for a typical metadata row
  • SSD random read: ~100 microseconds; HDD: ~10 milliseconds; memory: ~100 nanoseconds
  • Network round trip within a data center: ~0.5 ms; cross-continent: ~100-150 ms
  • A single server can handle roughly 10K-50K concurrent connections (depending on workload)

Common Design Problems

URL Shortener: hash/counter to generate short codes, key-value store (code -> original URL), 301 vs. 302 redirects, analytics via async event logging.

News Feed / Timeline: fan-out on write (pre-compute feeds for followers) vs. fan-out on read (compute at request time). Hybrid approach for celebrities.

Chat System: WebSocket connections for real-time delivery, message storage in a time-series-friendly database, presence service, group chat fan-out.

Rate Limiter: token bucket or sliding window algorithm, implemented in Redis for distributed consistency, placed at the API gateway layer.

Distributed Key-Value Store: consistent hashing for partitioning, replication factor of 3, quorum reads/writes (W + R > N), vector clocks or last-writer-wins for conflict resolution.

Practice Strategy

  1. Practice with a timer: give yourself 35 minutes per problem, mimicking real interview conditions.
  2. Talk out loud: narrate your thinking even when practicing alone; the interviewer evaluates your process.
  3. Draw diagrams: use boxes, arrows, and labels. Practice on a whiteboard or drawing tool.
  4. Study real architectures: read engineering blogs from companies (Meta, Uber, Netflix, Stripe) to see how real systems are built.
  5. Do at least 8-10 full design exercises before your interview, covering storage-heavy, compute-heavy, and real-time systems.

Common Mistakes

  • Jumping into components without clarifying requirements and scale first
  • Designing for current scale only and not explaining how the system grows
  • Ignoring failure modes: what happens when a server crashes, a database goes down, or the network partitions?
  • Over-engineering: adding Kafka, Redis, and microservices when the problem is a simple CRUD app serving 100 users
  • Not quantifying: saying "we need a cache" without estimating the cache size or hit rate
  • Neglecting security, authentication, and data privacy — mention them even if you do not deep-dive

Anti-Patterns

Over-engineering for hypothetical scale. Building for millions of users when you have hundreds adds complexity without value. Solve today's problems first.

Ignoring the existing ecosystem. Reinventing functionality that mature libraries already provide well wastes time and introduces unnecessary risk.

Premature abstraction. Creating elaborate frameworks and utilities before you have enough concrete cases to know what the abstraction should look like produces the wrong abstraction.

Neglecting error handling at boundaries. Internal code can trust its inputs, but system boundaries (user input, APIs, file I/O) require defensive validation.

Skipping documentation for obvious code. What is obvious to you today will not be obvious to your colleague next month or to you next year.

Install this skill directly: skilldb add interview-prep-skills

Get CLI access →