Tech

System Design

System design interviews evaluate your ability to architect large-scale, distributed software systems from scratch. You might be asked to design a URL shortener, a social media feed, or a real-time messaging platform. Strong answers demonstrate knowledge of trade-offs between consistency and availability, horizontal scaling, caching strategies, load balancing, and database sharding — skills that distinguish senior engineers.

What you get

Questions

20

Difficulty

3 levels

Answer Formats

2

Use the toggle on each card to move between an interview-ready answer and a simpler explanation. Questions are sorted from beginner to advanced, and the keywords are highlighted. You can also blur the answers to practice recalling them from memory.

Questions

Practice the answers out loud.

All topics

Question 1

What is system design and why is it important?

Beginner

How to answer in an interview

System design is the process of defining the architecture, components, and data flow of a software system to meet specified functional and non-functional requirements like scalability, reliability, and performance. It's important because good design decisions early on prevent costly rework and ensure a system can handle growth in users and data.

Question 2

Explain horizontal vs vertical scaling.

Beginner

How to answer in an interview

Vertical scaling means adding more resources, like CPU or RAM, to a single existing server, which is simple but has physical limits and creates a single point of failure. Horizontal scaling means adding more machines to distribute the load, which offers better fault tolerance and near-limitless growth but requires more complex coordination like load balancing.

Question 3

What is a CDN (Content Delivery Network)?

Beginner

How to answer in an interview

A CDN is a network of geographically distributed servers that cache and deliver content, like images, videos, and static files, from a location closer to the end user, reducing latency and offloading traffic from the origin server. It's widely used to speed up website loading times and handle traffic spikes.

Question 4

What is the difference between latency and throughput?

Beginner

How to answer in an interview

Latency is the time it takes for a single request to complete, usually measured in milliseconds, while throughput is the number of requests a system can process within a given time period, usually measured in requests per second. A system can have low latency but low throughput, or high throughput but high latency, so both metrics matter for performance evaluation.

Question 5

What is load balancing?

Intermediate

How to answer in an interview

A load balancer distributes incoming network traffic across multiple servers to prevent any single server from being overwhelmed, improving availability and reliability. Common algorithms include round robin, least connections, and IP hashing, and load balancers often perform health checks to route traffic only to healthy servers.

Question 6

Explain caching and cache invalidation strategies.

Intermediate

How to answer in an interview

Caching stores frequently accessed data in fast storage, like memory, to reduce load on slower backend systems and improve response times. Cache invalidation strategies include time-based expiration (TTL), write-through caching where the cache updates alongside the database, and cache-aside where the application explicitly loads and invalidates cache entries.

Question 7

How do SQL and NoSQL databases compare in a system design context?

Intermediate

How to answer in an interview

SQL databases suit systems needing strong consistency, complex relationships, and transactional guarantees, like banking systems. NoSQL databases suit systems prioritizing horizontal scalability, flexible schemas, and high write throughput, like social media feeds or IoT data, though often at the cost of some consistency guarantees.

Question 8

What is a message queue and why is it used?

Intermediate

How to answer in an interview

A message queue enables asynchronous communication between services by allowing a producer to send messages that a consumer processes independently, decoupling the two components and improving fault tolerance. It's used to smooth out traffic spikes, enable retrying failed operations, and allow services to scale independently, with tools like RabbitMQ and Kafka being common implementations.

Question 9

Explain microservices vs monolithic architecture.

Intermediate

How to answer in an interview

A monolithic architecture bundles all application functionality into a single deployable unit, which is simpler to develop and deploy initially but harder to scale and maintain as it grows. Microservices architecture breaks the application into small, independently deployable services communicating over APIs, improving scalability and team autonomy but adding operational complexity like service discovery and distributed monitoring.

Question 10

Explain rate limiting and common algorithms used.

Intermediate

How to answer in an interview

Rate limiting restricts the number of requests a client can make within a given time window to protect a system from abuse or overload. Common algorithms include the token bucket, where tokens refill at a fixed rate and each request consumes one; the leaky bucket, which processes requests at a constant rate; and sliding window counters, which track requests within a moving time frame for more precise limiting.

Question 11

What is a reverse proxy?

Intermediate

How to answer in an interview

A reverse proxy sits in front of backend servers and forwards client requests to them, often handling tasks like load balancing, SSL termination, caching, and hiding the internal server architecture from clients. Tools like Nginx and HAProxy are commonly used as reverse proxies.

Question 12

Explain database replication.

Intermediate

How to answer in an interview

Database replication involves copying data from a primary database to one or more replica databases, often used to improve read scalability by routing read queries to replicas, and to provide high availability by promoting a replica to primary if the original fails. Replication can be synchronous, ensuring replicas are always up to date at the cost of latency, or asynchronous, which is faster but risks slight data lag.

Question 13

What is an API gateway?

Intermediate

How to answer in an interview

An API gateway acts as a single entry point for client requests in a microservices architecture, handling cross-cutting concerns like routing to the appropriate service, authentication, rate limiting, and request/response transformation, so individual services don't need to duplicate this logic.

Question 14

How do you handle a single point of failure in system design?

Intermediate

How to answer in an interview

To eliminate a single point of failure, you introduce redundancy by running multiple instances of critical components across different servers or availability zones, combined with automatic failover mechanisms and health checks so traffic reroutes if one instance goes down. Load balancers, database replicas, and multi-region deployments are common techniques.

Question 15

What is database sharding?

Advanced

How to answer in an interview

Sharding is a database partitioning technique that splits a large dataset across multiple servers, or shards, based on a shard key, allowing the system to scale horizontally beyond what a single database server could handle. Challenges include choosing a good shard key to avoid hotspots and handling cross-shard queries or joins.

Question 16

Explain the CAP theorem.

Advanced

How to answer in an interview

The CAP theorem states that a distributed system can only guarantee two out of three properties simultaneously: Consistency, meaning every read gets the most recent write; Availability, meaning every request gets a response; and Partition tolerance, meaning the system continues to function despite network failures between nodes. Since network partitions are inevitable in distributed systems, designers must choose between prioritizing consistency (CP) or availability (AP).

Question 17

How would you design a URL shortener?

Advanced

How to answer in an interview

I'd generate a unique short code for each long URL, either using a hash function truncated to a fixed length with collision checks, or an auto-incrementing ID encoded in base62. I'd store the mapping in a database with the short code as a key for fast lookups, add a cache layer like Redis for frequently accessed URLs, and consider read replicas since reads vastly outnumber writes in this system.

Question 18

What is eventual consistency?

Advanced

How to answer in an interview

Eventual consistency is a consistency model used in distributed systems where updates propagate to all replicas over time, meaning reads immediately after a write might return stale data, but given enough time without new updates, all replicas will converge to the same value. It's a trade-off often chosen in AP systems to favor availability and partition tolerance over strict consistency.

Question 19

Explain consistent hashing.

Advanced

How to answer in an interview

Consistent hashing maps both data and servers onto a virtual ring using a hash function, so that when a server is added or removed, only a small fraction of keys need to be remapped, rather than rehashing the entire dataset. It's widely used in distributed caching systems and databases to minimize disruption during scaling events.

Question 20

How would you design a rate limiter for an API?

Advanced

How to answer in an interview

I'd implement a token bucket algorithm where each client has a bucket that refills tokens at a fixed rate, and each request consumes a token, rejecting requests when the bucket is empty. For a distributed system with multiple servers, I'd store the token counts in a fast shared store like Redis to keep limits consistent across all instances, using atomic operations to avoid race conditions.

More in Tech

Keep browsing related topics.

Browse all