System design rounds are a key part of interviews for experienced software engineers. These system design interview questions cover scalability basics, load balancing and caching for those starting out, then databases and sharding, consistency, message queues, rate limiting and classic designs such as a URL shortener and chat system for senior engineers.
30 questions · Updated
Reading answers is not the same as saying them.Practise System Design questions out loud and get a score, what you missed and a model answer for each one.
Practise free with AISystem Design Interview Questions: 30 questions with model answers on this page.
Basic System Design interview questions
Fundamentals, definitions and simple scenarios. Good for freshers and warm-ups.
1. What is the difference between vertical and horizontal scaling?
Vertical scaling means adding more power, such as CPU and memory, to one server; it is simple but has a hardware limit and a single point of failure. Horizontal scaling means adding more servers and spreading the load across them; it scales much further and improves availability, but needs stateless services, load balancing and handling of distributed data.
2. What does a load balancer do?
Answer flow · 3 steps
1
A load balancer distributes incoming requests across multiple servers, so no single server is overloaded, and stops sending traffic to unhealthy servers using health checks.
2
Algorithms include round robin, least connections and IP hash.
3
Layer 4 balancers route by IP and port; layer 7 balancers route by HTTP details such as path or headers.
3. Why use caching, and where can you cache?
Answer flow · 3 steps
1
Caching stores frequently used data in faster storage to reduce latency and load on databases.
2
You can cache in the browser, at a CDN for static content, in the application's memory, in a distributed cache such as Redis or Memcached, and in the database's own buffers.
3
The hard parts are invalidation and keeping data fresh, handled with TTLs and update strategies.
4. How should you approach a system design interview?
Clarify functional and non-functional requirements (scale, latency, availability, consistency), estimate traffic and storage, define the main APIs and data model, draw a high-level design with clients, load balancers, services, databases and caches, then go deep into the hardest parts, such as scaling the database or handling failures. Discuss trade-offs openly and keep checking with the interviewer.
5. What is the difference between latency and throughput?
Answer flow · 3 steps
1
Latency is how long one request takes, such as 120 milliseconds to load a page, usually measured at percentiles such as p95 and p99 rather than averages.
2
Throughput is how many requests the system handles per unit of time, such as 5,000 requests per second.
3
Improving one can hurt the other, for example batching increases throughput but adds latency.
6. What is a CDN?
Answer flow · 3 steps
1
A content delivery network caches content on servers close to users around the world, so static files, images, videos and even some API responses load faster and the origin server handles less traffic.
2
CDNs also absorb traffic spikes and DDoS attacks.
3
Content is refreshed using cache headers, versioned file names or explicit invalidation.
7. What role does DNS play in system design?
Answer flow · 3 steps
1
DNS translates domain names into IP addresses.
2
It can also route traffic: weighted routing for gradual migrations, latency-based or geolocation routing to send users to the nearest region, and failover routing with health checks for disaster recovery.
3
DNS changes propagate slowly because of caching, controlled by the TTL.
8. What is the difference between stateless and stateful services?
A stateless service keeps no client data between requests, so any server can handle any request, which makes horizontal scaling and replacing servers easy; session data lives in a shared store such as Redis or in tokens. A stateful service keeps data in memory or on local disk, such as databases or WebSocket servers, which requires careful routing, replication and failover.
9. How does database replication work?
Answer flow · 3 steps
1
In leader-follower replication, all writes go to the leader, which copies changes to followers that serve reads, increasing read capacity and providing failover.
2
Replication can be synchronous (safer, slower) or asynchronous (faster, but followers may lag, so users might not immediately see their own writes).
3
Multi-leader and leaderless replication allow writes in several places at the cost of conflict handling.
10. What are SLAs, SLOs and SLIs?
Answer flow · 4 steps
1
An SLI (service level indicator) is a measured metric, such as the percentage of successful requests or p99 latency.
2
An SLO (service level objective) is the target for it, such as 99.9% of requests succeeding each month.
3
An SLA (service level agreement) is a contract with customers with consequences if targets are missed.
4
99.9% availability allows about 43 minutes of downtime per month.
11. What makes a good API design?
Clear resource-based endpoints with the right HTTP methods and status codes, consistent naming and error format, pagination for lists, versioning, authentication and rate limiting, and idempotency for operations that may be retried, such as payments, using an idempotency key. For internal service-to-service calls, gRPC gives efficient, strongly typed communication.
Intermediate System Design interview questions
Applied problems, trade-offs and questions about your own projects.
12. Explain the CAP theorem.
Answer flow · 4 steps
1
In a distributed system, when a network partition happens, you must choose between consistency (every read gets the latest write) and availability (every request gets a response).
2
Partition tolerance is unavoidable in practice.
3
Banking systems usually prefer consistency, while social feeds prefer availability with eventual consistency.
4
PACELC adds that, even without partitions, you trade latency against consistency.
13. When would you choose SQL vs NoSQL?
Answer flow · 3 steps
1
SQL databases suit structured data with relationships, complex queries and strong consistency through transactions, such as orders and payments.
2
NoSQL databases suit flexible schemas, very high write throughput and horizontal scale, such as key-value stores for sessions, document stores for catalogues and wide-column stores for time-series.
3
Many systems use both for different data.
14. What are message queues, and why use them?
Answer flow · 3 steps
1
Message queues such as Kafka, RabbitMQ or SQS let services communicate asynchronously: producers publish messages and consumers process them at their own pace.
2
They decouple services, absorb traffic spikes, allow retries and enable event-driven architectures.
3
Consumers must handle duplicate messages idempotently because most queues guarantee at-least-once delivery.
15. What is database sharding?
Answer flow · 4 steps
1
Sharding splits data across multiple database servers by a shard key, such as user ID, so each server holds a part of the data and handles part of the load.
2
Strategies include range, hash and directory-based sharding.
3
Challenges are choosing a key that spreads load evenly, cross-shard queries and joins, rebalancing when adding shards, and hot spots.
4
Read replicas are a simpler first step for read-heavy loads.
16. What is consistent hashing?
Answer flow · 4 steps
1
With simple modulo hashing, adding or removing a server changes where almost every key goes.
2
Consistent hashing places servers and keys on a ring, and each key belongs to the next server clockwise, so adding or removing a server only moves the keys next to it.
3
Virtual nodes spread load evenly.
4
It is used in distributed caches, databases such as Cassandra and DynamoDB, and load balancers.
17. What caching strategies and eviction policies are there?
Answer flow · 4 steps
1
Cache-aside: the app reads the cache and loads from the database on a miss.
2
Write-through: writes go to the cache and database together, keeping them consistent.
3
Write-back: writes go to the cache and are saved to the database later, which is fast but can lose data.
4
Eviction policies such as LRU (least recently used), LFU (least frequently used) and TTL expiry decide what to remove when the cache is full.
18. When would you choose microservices over a monolith?
Answer flow · 3 steps
1
A monolith is one deployable application, simpler to build, test and deploy, and the right start for most products and small teams.
2
Microservices split the system into independently deployable services owned by separate teams, allowing independent scaling and releases, but add network calls, distributed data, complex debugging and operational overhead.
3
A modular monolith is a good middle ground until scale demands splitting.
19. What is an API gateway?
Answer flow · 4 steps
1
An API gateway is the single entry point for clients in front of many services.
2
It handles routing, authentication, rate limiting, request transformation, caching, logging and sometimes aggregating responses from several services.
3
It keeps cross-cutting concerns out of individual services.
4
Examples are Kong, AWS API Gateway, Apigee and Spring Cloud Gateway.
20. How do you do back-of-the-envelope estimation?
Answer flow · 3 steps
1
Start from users and behaviour: for example 10 million daily active users each making 20 requests gives 200 million requests a day, roughly 2,300 per second on average, and perhaps 5 to 10 times that at peak.
2
Multiply by object size to estimate storage and bandwidth, such as 1 KB per record times 100 million records per day giving about 100 GB per day.
3
Round numbers aggressively; the goal is the order of magnitude.
21. How do you make retries safe?
Answer flow · 3 steps
1
Network calls fail, so clients retry, which can duplicate actions such as charging a card twice.
2
Make operations idempotent: the client sends a unique idempotency key and the server stores the result for that key and returns it again on a retry.
3
Retries should use exponential backoff with jitter and a limit, and circuit breakers stop calling a service that is clearly down.
22. What is the outbox pattern?
When a service must update its database and publish an event, doing both separately can leave them inconsistent if one fails. With the outbox pattern, the service writes the business change and the event into an outbox table in the same database transaction, and a separate process or change data capture tool such as Debezium reads the outbox and publishes the events reliably.
High level System Design interview questions
System design, deep internals, leadership and tough follow-ups.
23. How would you design a URL shortener like bit.ly?
Answer flow · 3 steps
1
Requirements: create short links, redirect quickly, handle far more reads than writes.
2
I generate a unique ID with a counter or distributed ID generator and encode it in base62 to get a 7-character code, store code-to-URL mappings in a key-value store or sharded database, and serve redirects with 301 or 302 through a cache such as Redis and a CDN since reads dominate.
3
I add rate limiting, link expiry and asynchronous click analytics through a queue.
24. How would you design a chat application like WhatsApp?
Answer flow · 4 steps
1
Clients keep persistent WebSocket connections to chat servers, with a service tracking which server each user is connected to.
2
A message is stored in a database partitioned by conversation (such as Cassandra), then pushed to the recipient's server, or queued and sent through push notifications if they are offline.
3
Delivery and read receipts are acknowledgements.
4
Group messages fan out to members, media goes to object storage with a CDN, and end-to-end encryption happens on clients.
25. How would you design a rate limiter?
Answer flow · 4 steps
1
I would use a token bucket or sliding window algorithm, keyed by user, API key or IP, with counters in Redis updated atomically using INCR with expiry or a Lua script, so all API servers share limits.
2
It runs in an API gateway or middleware.
3
Over-limit requests get HTTP 429 with a Retry-After header.
4
I would decide whether to fail open or closed if Redis is unavailable, and allow different limits per plan.
26. How would you design a news feed like Instagram or X?
Answer flow · 3 steps
1
Users post content stored in a posts database and media in object storage behind a CDN.
2
Feeds can be built on write (fan-out to followers' precomputed feeds in Redis when someone posts), which makes reading fast, or on read (gather posts from followed accounts when the feed is opened), which suits celebrities with millions of followers.
3
Most systems use a hybrid, then rank posts with a model, paginate with cursors and cache heavily.
27. How would you design a notification system?
Answer flow · 3 steps
1
Services publish notification requests to a queue.
2
A notification service checks user preferences, rate limits and quiet hours, renders templates and sends each notification to channel workers for push (APNs and FCM), SMS, email and in-app delivery, through separate queues so one slow channel does not block others.
3
It tracks delivery status, retries failures with backoff, deduplicates messages and records analytics.
28. How would you design a video streaming service like YouTube?
Answer flow · 4 steps
1
Uploads go directly to object storage with pre-signed URLs.
2
A processing pipeline using queues and workers transcodes each video into several resolutions and bitrates and splits it into small segments for adaptive streaming (HLS or DASH), so players switch quality based on bandwidth.
3
Segments are served through CDNs.
4
Metadata, search, recommendations, view counts and comments are separate services with their own storage.
29. How do you handle transactions across microservices?
Distributed transactions with two-phase commit are slow and fragile across services, so most systems use the saga pattern: a sequence of local transactions, each publishing an event that triggers the next step, with compensating actions to undo earlier steps if a later one fails, such as refunding a payment when stock cannot be reserved. Sagas can be choreographed with events or orchestrated by a central coordinator.
30. How would you design a ride-hailing service like Uber or Ola?
Answer flow · 3 steps
1
Driver apps send location updates every few seconds to a location service that stores current positions in an in-memory geospatial index, such as Redis with geohashes or H3 cells.
2
A matching service finds nearby available drivers for a ride request and offers the trip, using locking so one driver is not matched twice.
3
Trips, payments, pricing (including surge based on demand in each area), ETAs and notifications are separate services, with WebSockets for live tracking.
Ready to test yourself?Pick your topics and level, answer by voice or text, and get instant feedback. Free.