Cards
Every card has a stable URL you can share. Search matches prompts, ids and tags.
64 of 64 cards
- designsdesign
Design a messaging system like WhatsApp or Slack supporting 1:1 and group chats, online presence, and message history across devices.
#chat-systemdifficulty ●●●realtime, messaging, storage
- designsdesign
Design a file sync service like Dropbox: files edited on one device appear on all the user's devices, with large files, conflict handling and bandwidth efficiency.
#cloud-file-syncdifficulty ●●●storage, consistency, realtime
- designsdesign
Design a distributed in-memory cache like Memcached or Redis Cluster that applications use to offload reads from their databases.
#distributed-cachedifficulty ●●○caching, availability, scalability
- designsdesign
Design a distributed key-value store like DynamoDB or Cassandra that stays available under node failures and scales horizontally.
#distributed-kv-storedifficulty ●●●storage, replication, consistency
- designsdesign
Design a metrics collection and alerting system that ingests millions of time-series data points per second, serves dashboards, and fires alerts.
#metrics-monitoring-systemdifficulty ●●●observability, storage, streaming
- designsdesign
Design a social news feed: users follow others, post updates, and see a ranked timeline of posts from the people they follow.
#news-feeddifficulty ●●○caching, messaging, scalability
- designsdesign
Design a notification service that delivers push, SMS and email to users at scale, with user preferences, rate limits and retries.
#notification-systemdifficulty ●●○messaging, availability, api
- designsdesign
Design a payment system for an e-commerce platform that charges customers, pays out merchants, and never loses or duplicates money.
#payment-systemdifficulty ●●●consistency, idempotency, security
- designsdesign
Design a distributed rate limiter that enforces per-client limits across a fleet of API servers with low latency.
#rate-limiterdifficulty ●●○rate-limiting, caching, api
- designsdesign
Design the core of a ride-hailing service like Uber: track driver locations, match riders to nearby drivers, and run the trip lifecycle.
#ride-hailingdifficulty ●●●geo, realtime, messaging
- designsdesign
Design a search autocomplete (typeahead) service that returns the top 10 suggestions for a prefix within 100 ms, updated from recent query popularity.
#typeahead-suggestionsdifficulty ●●○search, caching, data-structures
- designsdesign
Design a service that generates unique, roughly time-ordered 64-bit ids across many datacenters at millions per second with no single point of failure.
#unique-id-generatordifficulty ●●○databases, scalability, consistency
- designsdesign
Design a URL shortener like bit.ly: create short links, redirect quickly at scale, and track click counts.
#url-shortenerdifficulty ●○○databases, caching, api
- designsdesign
Design a video platform like YouTube: upload, transcode, store and stream videos to millions of concurrent viewers with adaptive quality.
#video-streamingdifficulty ●●●streaming, cdn, storage
- designsdesign
Design a web crawler that downloads billions of pages, respects site politeness rules, avoids duplicates, and keeps content reasonably fresh.
#web-crawlerdifficulty ●●●messaging, storage, scalability
- estimationestimation
A video service has 5 million concurrent viewers at peak, streaming an average 3 Mbps. Estimate peak egress bandwidth and daily data transfer, and say what that implies for architecture.
#bandwidth-for-video-streamingdifficulty ●●○estimation, streaming, cdn
- estimationestimation
A news feed service serves 10 billion post reads a day across 500 million posts of ~1 KB each. Size a cache to serve 80% of reads from memory, and estimate the database read load that remains.
#cache-size-80-20difficulty ●●○estimation, caching
- estimationestimation
A messaging app has 500 million DAU sending 40 messages each per day. Estimate message write rate, fan-out delivery rate for group chats, concurrent connections, and daily message storage.
#chat-messages-per-seconddifficulty ●●○estimation, realtime, messaging
- estimationestimation
Recite the latency ladder from an L1 cache hit to a cross-continent round trip, to within an order of magnitude. Which steps change a design?
#latency-numbersdifficulty ●○○estimation, latency
- estimationestimation
Give the powers of two that matter for capacity planning, and typical sizes for common objects such as an integer, a UUID, a tweet, a web page and a photo.
#powers-of-two-and-data-sizesdifficulty ●○○estimation, storage
- estimationestimation
A product has 100 million daily active users who each make 20 requests a day. Estimate average and peak QPS, and explain the assumptions.
#qps-from-daily-active-usersdifficulty ●○○estimation, scalability
- estimationestimation
A database sees 2,000 writes per second and a 50:1 read-to-write ratio. A single node handles ~15,000 queries per second. How many read replicas do you need, and what else should you check?
#read-write-ratio-and-replicasdifficulty ●●○estimation, replication, databases
- estimationestimation
Your API must serve 60,000 peak QPS with a p99 under 200 ms. Each request takes ~50 ms of service time on one core. How many servers do you need?
#server-count-from-qpsdifficulty ●●○estimation, scalability, availability
- estimationestimation
A photo-sharing app has 50 million daily active users; 10% upload two photos a day at ~2 MB each. Estimate daily and five-year storage, including thumbnails and replication.
#storage-for-photo-sharingdifficulty ●●○estimation, storage
- estimationestimation
A URL shortener creates 100 million links a month with a 100:1 read-to-write ratio. Estimate write and read QPS, storage for 10 years, and how many characters the short code needs.
#url-shortener-capacitydifficulty ●○○estimation, storage, databases
- fundamentalstradeoff
Compare offset pagination with cursor (keyset) pagination for a list endpoint. When is offset acceptable?
#api-paginationdifficulty ●○○api, databases, latency
- fundamentalstradeoff
Compare server-side sessions with stateless JWTs for authenticating API requests. How do you handle logout and revocation in each?
#authn-authz-basicsdifficulty ●●○security, api, scalability
- fundamentalstradeoff
Where do you store user-uploaded images and videos, and what goes in the database? How do clients upload and download them?
#blob-storage-vs-databasedifficulty ●○○storage, scalability, cdn
- fundamentalsconcept
What is a Bloom filter, what guarantees does it give, and where would you use one in a large system?
#bloom-filtersdifficulty ●●○data-structures, caching, storage
- fundamentalsconcept
Explain LRU, LFU and TTL-based eviction. How do you decide which to use and how would you implement LRU in O(1)?
#cache-eviction-policiesdifficulty ●○○caching, data-structures
- fundamentalstradeoff
How do you keep a cache consistent with its source of truth? Compare TTL expiry, explicit invalidation and versioned keys.
#cache-invalidation-and-ttldifficulty ●●○caching, consistency
- fundamentalstradeoff
Compare write-through, write-back and write-around caching. When would you pick each?
#caching-write-strategiesdifficulty ●●○caching, consistency, durability
- fundamentalsconcept
State the CAP theorem precisely and explain what it does and does not tell you about real systems.
#cap-theoremdifficulty ●●○consistency, availability
- fundamentalsconcept
What is a CDN, what problems does it solve, and what can it not help with?
#cdn-basicsdifficulty ●○○cdn, latency, caching
- fundamentalstradeoff
You are sharding a multi-tenant SaaS database. How do you choose the shard key, and what goes wrong with the obvious choices?
#choosing-a-shard-keydifficulty ●●●sharding, databases, scalability
- fundamentalstradeoff
A query filters on tenant_id and status and sorts by created_at. How do you order the columns in a composite index, and why?
#composite-index-column-orderdifficulty ●●○indexing, databases
- fundamentalsconcept
Define linearizability, sequential consistency, causal consistency and eventual consistency. Give a user-facing example of each guarantee failing.
#consistency-modelsdifficulty ●●●consistency, replication
- fundamentalsconcept
Explain consistent hashing. What problem does it solve compared with hash-mod-N, and what are virtual nodes for?
#consistent-hashingdifficulty ●●○sharding, caching, data-structures
- fundamentalsconcept
Explain CQRS and event sourcing. What problems do they solve, how do they relate, and what makes them expensive?
#cqrs-and-event-sourcingdifficulty ●●●architecture, messaging, consistency
- fundamentalsconcept
How does a B-tree index speed up a query, and what does it cost? When would you not add an index?
#database-indexesdifficulty ●○○databases, indexing
- fundamentalstradeoff
Explain at-most-once, at-least-once and exactly-once delivery. Why is exactly-once so hard, and how do systems approximate it?
#delivery-guaranteesdifficulty ●●○messaging, idempotency, consistency
- fundamentalstradeoff
Your API runs on 50 instances behind a load balancer. How do you enforce a per-customer rate limit across all of them? Compare the options.
#distributed-rate-limitingdifficulty ●●●rate-limiting, caching, consistency
- fundamentalsconcept
How do DNS and anycast route a user to the nearest healthy datacenter? What are the limits of each approach?
#dns-and-anycastdifficulty ●●○networking, availability, latency
- fundamentalsconcept
How do you efficiently find all drivers within 2 km of a rider? Compare geohash, quadtree and S2/H3 cell approaches.
#geospatial-indexingdifficulty ●●○geo, indexing, data-structures
- fundamentalsconcept
How does a distributed system decide that a node is dead? Explain heartbeats, timeouts and why failure detection is fundamentally uncertain.
#heartbeats-and-failure-detectiondifficulty ●●○availability, observability, consistency
- fundamentalsconcept
Design idempotency for a "create payment" endpoint so that client retries never double-charge. Walk through the request flow and the edge cases.
#idempotency-keysdifficulty ●●○idempotency, api, consistency
- fundamentalstradeoff
Compare layer 4 and layer 7 load balancing. When is each the right choice?
#l4-vs-l7-load-balancingdifficulty ●●○load-balancing, networking, latency
- fundamentalstradeoff
Compare single-leader, multi-leader and leaderless replication. When does each topology fit?
#leader-follower-vs-multi-leaderdifficulty ●●●replication, consistency, availability
- fundamentalsconcept
Name the common load-balancing algorithms and explain when you would pick each one.
#load-balancing-algorithmsdifficulty ●○○load-balancing, availability, scalability
- fundamentalsconcept
Why would you put a message queue between two services? What problems does it introduce?
#message-queues-basicsdifficulty ●○○messaging, availability, scalability
- fundamentalstradeoff
When should a team split a monolith into services, and when should it not? What does the split cost that people underestimate?
#microservices-vs-monolithdifficulty ●●○architecture, scalability, availability
- fundamentalstradeoff
Compare optimistic and pessimistic concurrency control. How would you protect seat booking versus editing a wiki page?
#optimistic-vs-pessimistic-lockingdifficulty ●●○concurrency, databases, consistency
- fundamentalsconcept
What does PACELC add to CAP, and how would you classify a few well-known systems with it?
#pacelcdifficulty ●●○consistency, latency, availability
- fundamentalstradeoff
Compare push and pull CDNs. Which would you choose for a video platform versus a news site?
#push-vs-pull-cdndifficulty ●●○cdn, caching, storage
- fundamentalstradeoff
Compare a traditional message queue (RabbitMQ, SQS) with a distributed log (Kafka, Kinesis). When do you want each?
#queue-vs-logdifficulty ●●○messaging, streaming, architecture
- fundamentalsconcept
Compare token bucket, leaky bucket, fixed window and sliding window rate limiting. Which would you pick for a public API and why?
#rate-limiting-algorithmsdifficulty ●●○rate-limiting, api, data-structures
- fundamentalstradeoff
You add read replicas to scale a read-heavy app. What user-facing bugs does replication lag create and how do you prevent them?
#read-replicas-and-lagdifficulty ●●○replication, consistency, scalability
- fundamentalstradeoff
Compare short polling, long polling, server-sent events and WebSockets for pushing updates to a browser. Which would you use for a chat app, a stock ticker and a build-status page?
#realtime-transport-optionsdifficulty ●●○realtime, api, networking
- fundamentalstradeoff
Compare synchronous and asynchronous replication. What does each buy you and what does each cost?
#replication-sync-vs-asyncdifficulty ●●○replication, durability, latency
- fundamentalsconcept
How should a client retry a failed call to a dependency? Cover timeouts, backoff, jitter, retry budgets and what must not be retried.
#retries-timeouts-and-backoffdifficulty ●●○availability, api, latency
- fundamentalsconcept
How does full-text search work under the hood, and why not just use SQL LIKE? Explain inverted indexes, analysis and relevance scoring.
#search-indexing-basicsdifficulty ●●○search, indexing, data-structures
- fundamentalsconcept
Explain horizontal partitioning (sharding). Compare range, hash and directory-based sharding.
#sharding-strategiesdifficulty ●●○sharding, scalability, databases
- fundamentalstradeoff
When would you choose a relational database over a NoSQL store, and vice versa? Give concrete signals, not slogans.
#sql-vs-nosqldifficulty ●●○databases, scalability, consistency
- fundamentalsconcept
Explain the SQL isolation levels and the anomalies each prevents. Which level do production databases default to, and why?
#transaction-isolation-levelsdifficulty ●●●databases, consistency, concurrency