System Design Interview — Framework and Practice Questions

A repeatable interview framework, how to communicate trade-offs, common mistakes, and practice questions with answer outlines.

Est. 45 min Updated Suggest a fix
// Part 01 — A repeatable framework

Make Your Reasoning Easy to Follow

System-design interviews test how you turn an ambiguous prompt into a defensible design. Clarify users and goals; estimate scale, define API and data, then deep-dive into bottlenecks, failures, and trade-offs.

Treat the time boxes as a guide. Invite the interviewer to steer depth once the core design is visible.
StageWhat to produceUseful check
RequirementsUsers, core use cases, scope, and quality goals.Can I state what is deliberately out of scope?
EstimatesReads, writes, storage, bandwidth, and peak assumptions.Can I explain which estimate changes my design?
API and dataMain operations, identifiers, entities, and access patterns.Do the keys and indexes support the reads?
High-level designRequest path, stores, queues, and trust boundaries.Can I trace one request end to end?
Deep divesConsistency, caching, partitioning, failure recovery.What fails first and how does the system recover?
🎯 Pro Tip
Narrate decisions as a chain: requirement, constraint, selected mechanism, and cost. "I choose a queue" is a component name; "I queue analytics so provider latency cannot delay redirects, accepting slightly stale counts" is design reasoning.

Start with a modular service and a suitable store. Add caches, queues, replicas, or partitions only for stated needs, and explain their operational cost.

// Part 02 — Questions 1–5 · scope and estimates

Clarify the Problem Before You Scale It

1. How do you begin an open-ended design prompt?

Model answer: I restate the goal, identify primary users and journeys, then clarify scale, quality goals, privacy, and scope. I record assumptions and proceed instead of asking questions indefinitely.

What interviewers look for:

  • Prioritization and explicit scope instead of premature architecture
  • A willingness to state reasonable assumptions when the interviewer leaves details open.

2. Which non-functional requirements do you clarify first?

Model answer: I ask about read and write volume, peak-to-average ratio, latency expectations, availability, durability, and consistency. For user data I clarify access control and retention. I rank the goals because they can conflict: a strict freshness guarantee may increase latency or reduce availability during a partition.

What interviewers look for:

  • Connecting quality goals to a concrete design choice
  • Recognizing that no system can maximize every property simultaneously.

3. How do you estimate traffic without exact production metrics?

Model answer: I estimate actions from active users and usage, calculate average QPS, then state a peak factor. For storage, I multiply retained records by an assumed row size. I label assumptions and refine only when a decision depends on them.

What interviewers look for:

  • Readable arithmetic with assumptions and units
  • Awareness that averages hide peaks, skew, replicas, indexes, and retention.
estimate.py
python
SECONDS_PER_DAY = 86_400
active_users = 2_000_000
actions_per_user_per_day = 12
peak_factor = 4

actions_per_day = active_users * actions_per_user_per_day
average_qps = actions_per_day / SECONDS_PER_DAY
estimated_peak_qps = average_qps * peak_factor

print(f"average QPS: {average_qps:.1f}")
print(f"illustrative peak QPS: {estimated_peak_qps:.1f}")

4. How do you decide what to leave out of scope?

Model answer: I identify optional features that do not change the core architecture and defer them explicitly, such as attachments in a text-only chat exercise. I keep constraints that do change the design—like end-to-end encryption or large public groups—visible as open questions and say how the answer would change if they become mandatory.

What interviewers look for:

  • A tractable first version without hiding consequential assumptions
  • A clear explanation of which deferred requirements would force redesign.

5. What does a good capacity estimate change?

Model answer: It tells me whether a single database is a reasonable start, whether hot reads need a cache, whether writes can use one partition, and how much data retention costs. If the estimate does not affect a decision, I avoid false precision and move to the constraints that do.

What interviewers look for:

  • Estimates tied to storage, partitioning, or throughput choices
  • The ability to prioritize relevant math over ornamental calculations.
// Part 03 — Questions 6–10 · interfaces and architecture

Connect APIs and Data to the Request Path

6. How would you design a URL shortener's create API?

Model answer: An authenticated client submits a destination and optional expiry with an idempotency key. The server validates the scheme and policy, stores a unique code-to-destination mapping, then returns the canonical short URL. A repeated key with the same payload returns the prior result; a conflicting payload is rejected.

What interviewers look for:

  • Validation, ownership, and retry semantics in the contract
  • Durable creation before returning a successful short URL.

7. How do you choose a database for a new service?

Model answer: I start from entities, consistency needs, and access patterns. Relational storage is a strong default for transactional relationships and constraints. A key-value store may fit a simple high-volume key lookup. I compare query flexibility, scale, team operations, backups, and migration cost rather than selecting by product popularity.

What interviewers look for:

  • Evidence that schema and queries drive the choice
  • Acknowledgement of operational maturity and trade-offs, not just theoretical throughput.

8. When would you introduce a cache?

Model answer: I add a cache when repeated reads or latency justify it, after identifying the source of truth, cache key, TTL, and invalidation behavior. Cache-aside is easy to start with. For mutable data I bound staleness and protect against stampedes; I do not make a cache the only copy of critical data.

What interviewers look for:

  • Awareness that cache invalidation and stale reads are correctness concerns
  • A cache positioned around an observed bottleneck rather than added reflexively.

9. How do you shard a growing database?

Model answer: I choose a key that distributes writes and localizes common queries, such as conversation ID for chat. I check hot keys, cross-shard queries, and rebalancing. Indexes and replicas may suffice before sharding.

What interviewers look for:

  • Partition key justified by the access pattern
  • Recognition of skew, resharding, and cross-partition transaction costs.

10. What makes a queue-based design reliable?

Model answer: A queue absorbs bursts, but needs bounded retries, idempotent consumers, lag visibility, and poison-message handling. Use an outbox when a database write and publish must agree, and partition if order matters.

What interviewers look for:

  • An end-to-end failure story, not just a broker box
  • Safe duplicate processing and a plan for poison messages or growing backlog.
// Part 04 — Questions 11–15 · deep dives

Reason About Ordering, Fan-Out, and Coordination

11. How would you guarantee chat message order?

Model answer: I promise order within a conversation, not global order. The server assigns a monotonically increasing sequence per conversation using a transactional counter or ordered partition. Clients sort by that sequence and deduplicate stable message IDs. Very hot conversations may require a special scaling discussion.

What interviewers look for:

  • Ordering scope stated precisely
  • Correct handling of retries, duplicate events, and clock skew.

12. How would you handle fan-out to many followers or group members?

Model answer: For ordinary audiences, I can enqueue recipient deliveries asynchronously and track progress. For very large audiences, write-time fan-out may be expensive, so I consider a hybrid or read-time fan-out. I preserve a durable source event and make delivery idempotent; the product can tolerate bounded delay.

What interviewers look for:

  • Understanding write amplification versus read complexity
  • A design that separates durable content from delivery attempts.

13. How do you assign a rider to a delivery?

Model answer: A geo index finds eligible riders; I rank by road ETA, capacity, and workload, then reserve atomically. If no one accepts, expand the search or escalate rather than stall.

What interviewers look for:

  • Candidate generation separated from ranking and reservation
  • Handling of no-match, concurrent assignment, and changing availability.

14. What would you store for live location tracking?

Model answer: I keep the latest authorized location with an observed-at timestamp in a fast, short-lived store and publish a coalesced update to the active order. Durable order events record assignment and hand-off, not necessarily every GPS point. I restrict visibility and define retention based on product need.

What interviewers look for:

  • Freshness and privacy treated as requirements
  • Separation of ephemeral position from durable business history.

15. How do you avoid double-processing a payment or order?

Model answer: I store a stable idempotency key with the state transition and deduplicate callbacks by event ID. A timeout is ambiguous, so reconcile the provider reference before charging or refunding again.

What interviewers look for:

  • Distinguishing at-least-once delivery from exactly-once business effect
  • A recovery path for ambiguous external outcomes.
// Part 05 — Questions 16–20 · failure and operations

Show How the Design Behaves Under Stress

16. How should a service retry failed dependencies?

Model answer: Set deadlines and retry transient failures with bounded backoff and jitter. Retry non-idempotent work only with idempotency protection; circuit breakers and concurrency limits protect a failing dependency.

What interviewers look for:

  • Retries bounded by a request deadline and safe operation semantics
  • Awareness that retries can amplify an outage.

17. Where would you apply rate limiting?

Model answer: I rate-limit at the edge by authenticated principal, IP where appropriate, and expensive operation. A token bucket allows small bursts while enforcing a sustained rate. Limits should protect shared capacity without unfairly punishing users behind shared networks; provide clear retry guidance.

What interviewers look for:

  • A stated key, algorithm, and fairness concern
  • Different treatment for expensive writes and ordinary reads.
token_bucket.py
python
class TokenBucket:
    def __init__(self, capacity: float, refill_per_second: float) -> None:
        self.capacity = capacity
        self.tokens = capacity
        self.refill_per_second = refill_per_second
        self.updated_at = 0.0

    def allow(self, now: float, cost: float = 1.0) -> bool:
        elapsed = max(0.0, now - self.updated_at)
        self.tokens = min(self.capacity, self.tokens + elapsed * self.refill_per_second)
        self.updated_at = now
        if self.tokens < cost:
            return False
        self.tokens -= cost
        return True

bucket = TokenBucket(capacity=5, refill_per_second=1)
print(bucket.allow(now=1.0))

18. Which system-design metrics matter?

Model answer: I begin with user-visible latency percentiles, error and success rates, saturation, and traffic. Then I add domain indicators: queue age, payment reconciliation backlog, or stale location age. Structured logs and traces carry request or event IDs, but avoid sensitive payloads.

What interviewers look for:

  • Metrics tied to user outcomes and specific failure modes
  • Correlation IDs and privacy-aware telemetry.

19. How do you design for a region outage?

Model answer: Clarify recovery-point and recovery-time goals, then choose backup restore, warm standby, or active-active. Identify replicated state, failover ownership, split-brain risks, and test the procedure regularly.

What interviewers look for:

  • Recovery goals stated before a multi-region topology
  • Awareness that replication is not a tested recovery plan.

20. How do security and privacy change a design?

Model answer: I identify assets, actors, and trust boundaries. Authenticate users, authorize every resource access, encrypt network traffic, protect secrets, and minimize stored personal data. I define retention, audit sensitive actions, and threat-model public inputs and service-to-service permissions. Security is part of the request path, not a final component.

What interviewers look for:

  • Concrete controls attached to assets and boundaries
  • Data minimization and authorization considered alongside performance.
// Part 06 — Communicate trade-offs

Be Decisive, Then Explain the Cost

Choose a reasonable design, state its supporting assumption, and compare one alternative. A relational store may simplify transactional orders; a key-value store may scale direct lookups but shifts query and consistency work.

consumer_dedup.py
python
class EventConsumer:
    def __init__(self) -> None:
        self.processed: set[str] = set()
        self.count = 0

    def handle(self, event_id: str) -> bool:
        if event_id in self.processed:
            return False
        self.processed.add(event_id)
        self.count += 1
        return True

consumer = EventConsumer()
print(consumer.handle("evt-42"), consumer.handle("evt-42"))

Production consumers persist the idempotency marker and business update atomically. State this boundary rather than claiming exactly-once processing because of a queue setting.

📌 Real World Example
For example: "I use an outbox so a committed order cannot lose its event; consumers must handle duplicates." State both benefit and cost.

Draw the smallest complete path, trace a retry and failure, then close with the main trade-off, operating metric, and next scaling step.

// Part 07 — Pitfalls

Common Interview Mistakes

Starting with a list of services

Why: The architecture is disconnected from a user need and can change as requirements become clear.

Fix: Clarify scope and constraints first, then draw only components required by the request path.

Presenting assumptions as facts

Why: Unstated numbers make estimates sound precise while hiding uncertainty.

Fix: Label assumptions, show the calculation, and identify which unknown would change the design.

Designing only the happy path

Why: Timeouts, retries, duplicates, and stale data are where distributed systems fail.

Fix: Trace at least one failure and its recovery for every critical dependency.

Overengineering before a bottleneck exists

Why: Sharding and many services increase complexity without demonstrating a need.

Fix: Start with the simplest adequate design and name the signal that would justify the next step.

// Part 08 — Practice

Run a 35-Minute Mock Interview

Practice

Design a notification service for an Indian learning platform

  1. Clarify notification types, user preferences, urgency, delivery channels, and what must be persisted.
  2. Estimate daily notifications, burst rate around course announcements, and retained delivery records using explicit assumptions.
  3. Define APIs and data keys for enqueue, preference lookup, delivery attempt, and user-visible history.
  4. Draw a text architecture from producer through queue and workers to email, push, or in-app delivery.
  5. Explain retries, deduplication, quiet hours, provider outage recovery, and the metric that signals an unhealthy backlog.

Hint: Persist notifications, deliver asynchronously, and make retries idempotent.

🎯 Key Takeaways

  • ✓Use a consistent progression: requirements, estimates, API and data, high-level design, deep dives, bottlenecks, and trade-offs.
  • ✓State assumptions and connect calculations to a concrete decision.
  • ✓Design for duplicate requests, timeouts, partial failure, and recovery—not only the happy path.
  • ✓Choose the smallest architecture that meets stated goals and explain when you would evolve it.
  • ✓Make consistency, privacy, reliability, and operations part of the design conversation.
  • ✓Communicate one decision at a time: requirement, mechanism, benefit, and cost.

Next

What comes next

Continue with Operating Systems to learn how processes, concurrency, memory, and storage underpin the services you design.

Next course · Operating Systems →

HELP US IMPROVE

How was this lesson?

Your note is shared with the Chaduvuko team for review. Please don’t include personal or sensitive information.

Choose your feedback

Spotted a mistake or something unclear? Suggest a fix on GitHub or email us. Select the text first and it is quoted for you.

Share

Discussion

0

Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.

Continue with GitHub
Loading...