Interview Lab · System Design

System design interview questions

Eighteen L4–L6 prompts with why-asked, level expectations, whiteboard steps, and real company examples.

This lab is for L4–L6 system design loops — prompts repeatedly reported at Meta, Google, Amazon, Netflix, Stripe, and Uber in 2025–2026 (URL shortener warmups through Dropbox, payments, crawlers, and Kafka-style queues).

How to use it: Practice a 45-minute structure every time — clarify → capacity sketch → API → diagram → data model → deep dives → failures. Open a card, study it, then redraw from memory on a blank page.

URL shortener design overview

Related chapters: Approaching SD, Scaling, Caching, URL shortener, WhatsApp, Instagram, Uber.

Q1. Design a URL Shortener (Bitly)

Design a service like bit.ly: users submit a long URL and get a short link; opening the short link redirects to the original. Expect ~100M new URLs/month and a much higher read:write ratio. Walk a full 45-minute design.

Asked at: Amazon, Google, Microsoft, Uber — most common system-design opener · Difficulty: Medium · Pattern: Hashing · base62 IDs · read-heavy cache

Why interviewers ask this

~20 min to rehearse aloud

Perfect first SD question: read-heavy KV, ID generation, caching.

What they are evaluating
  • Clarify + capacity
  • ID scheme
  • Read vs write path
  • Analytics async
Level expectations
What interviewers expect by level
LevelExpectation
JuniorBasic API + DB + redirect
MidCache + base62 + 302 vs 301
SeniorMulti-region + abuse
StaffGlobal edge + consistency story
PrincipalPlatform constraints / multi-tenant shorteners
Expected answer shape
Clarify
  • Custom aliases? Expiry? Auth?
  • Analytics (click counts) required?
  • Latency: redirect p99 < 100ms?
  • Availability target (e.g. 99.9%)?
  • Assume ~7-char base62 codes unless they specify otherwise.
Diagram
URL shortener write and read paths
Step-by-step whiteboard
  1. API: POST /shorten {url, alias?} → code; GET /{code} → 302 Location: long URL.
  2. Capacity: 100M/mo ≈ 40 writes/s avg; reads can be thousands/s — cache is mandatory. Storage: 100M × ~500B ≈ 50GB+/yr metadata (order-of-magnitude OK).
  3. ID generation (pick one & defend): (1) distributed counter + base62; (2) hash URL + collision handling; (3) pre-generated key pool for bursts.
  4. Data model: code → {long_url, user_id, created, expires, clicks?}. KV/NoSQL or sharded SQL by code hash.
  5. Read path: edge/CDN optional → LB → app → Redis → DB. Prefer 302 (mapping can change; analytics stay server-side) unless they insist on 301.
  6. Analytics: async click events to Kafka/queue — never block redirect.
  7. Abuse: rate-limit shorten; malware URL scan offline.
Deep dives
  • Hot keys: viral links — cache replicas / local caches.
  • Enumeration: avoid raw sequential public IDs; salt / skip / encrypt.
  • Multi-region: replicate read-only mappings; write to primary with async replication.
  • Custom aliases: conditional put; reject if taken.
What strong answers sound like
Follow-up questions
  • Custom aliases?
  • Enumerate IDs?
  • Global latency?
Common mistakes
Real-world production examples
  • bit.ly / t.co style redirects
  • Amazon product short links
  • Firebase Dynamic Links patterns
Q2. Design Instagram / News Feed

Design a photo-sharing social network: follow users, upload photos, see a home feed of posts from people you follow (roughly reverse-chronological with light ranking).

Asked at: Meta, Instagram, Twitter/X interviews · Difficulty: Hard · Pattern: Hybrid fan-out · timeline cache · media CDN

Why interviewers ask this

~25 min to rehearse aloud

Tests fan-out tradeoffs — Meta’s signature problem.

What they are evaluating
  • Celebrity problem
  • Hybrid fan-out
  • Media CDN
  • Eventual consistency
Level expectations
What interviewers expect by level
LevelExpectation
JuniorChronological pull
MidPush fan-out
SeniorHybrid + ranking stage
StaffML ranker + diversity
PrincipalFeed platform multi-surface
Expected answer shape
Clarify
  • Scale: hundreds of millions of users?
  • Celebrity / mega-follower problem in scope?
  • Stories? Likes counters? Ranking ML?
  • Consistency: eventual feed OK?
Diagram
Hybrid fan-out for news feed
Step-by-step whiteboard
  1. Write media: pre-signed upload → object store + CDN; metadata row (post_id, author, caption, media_url, ts).
  2. Fan-out on write: push post_id into each follower's timeline cache (Redis lists) — great for normal users.
  3. Fan-out on read / pull: for celebrities, do not push to tens of millions of timelines; merge recent posts at read time.
  4. Hybrid: write-fanout for normals, pull for celebs (or inactive users).
  5. Read path: auth → timeline cache → hydrate posts → CDN URLs.
  6. Ranking: start chronological; add retrieval + re-rank stage later.
  7. Sharding: user_id for timelines; post_id for posts.
Deep dives
  • Counters (likes/views): sharded in-memory with periodic flush; approximate display OK.
  • Notifications / stories: separate services + queues.
  • Feed can be eventually consistent; durable post metadata is enough for ACK.
Follow-up questions
  • Stories?
  • Live counters?
  • Unfollow consistency?
Common mistakes
Real-world production examples
  • Instagram/FB feed
  • LinkedIn feed fanout
  • Twitter/X home timeline
Q3. Design WhatsApp / Chat

Design 1:1 and group messaging with delivery receipts, online presence, and media sharing. Focus on low latency and reliability.

Asked at: Meta, WhatsApp, Slack, Discord-style rounds · Difficulty: Hard · Pattern: WebSocket · durable log · presence · group fan-out

Why interviewers ask this

~25 min to rehearse aloud

Realtime systems, durability, fan-out — Meta/Slack loops.

What they are evaluating
  • WS/sticky
  • Persist before ACK
  • Group strategy
  • Presence
Level expectations
What interviewers expect by level
LevelExpectation
Junior1:1 WS + DB
MidOffline store-and-forward
SeniorLarge groups + E2E talk
StaffMulti-device sync
PrincipalGlobal chat fabric
Expected answer shape
Clarify
  • E2E encryption in scope?
  • Max group size?
  • Multi-device sync?
  • Message history retention?
Diagram
Chat message delivery path
Step-by-step whiteboard
  1. Connections: sticky WebSocket/MQTT to chat servers; presence map user→server in Redis.
  2. Send path: client → chat server → durable queue/log (Kafka) → fan-out to recipient inboxes → push to online sockets or store-and-forward if offline.
  3. ACK: persist before ACK to sender (at-least-once); clients de-dupe by message_id.
  4. Ordering: per-conversation monotonic sequence from a single partition/writer.
  5. Groups: small → fan-out to members; large → group log + members catch up / notify online only.
  6. Media: upload to blob store; message carries URL/thumbnail.
  7. Presence: heartbeats with short TTL.
  8. Receipts: separate lightweight events; do not block delivery.
E2E note
Follow-up questions
  • E2E encryption?
  • Read receipts scale?
  • Message edit/delete?
Common mistakes
Real-world production examples
  • WhatsApp
  • Slack channels
  • Discord large guilds patterns
Q4. Design a Rate Limiter

Design a distributed rate limiter for an API gateway: e.g. 100 requests per user per minute, consistent across many gateway instances.

Asked at: Amazon, Stripe, Cloudflare, Google — building-block favorite · Difficulty: Medium · Pattern: Token bucket · sliding window · Redis

Why interviewers ask this

~15 min to rehearse aloud

Building block that appears inside every API design.

What they are evaluating
  • Algorithm choice
  • Atomic Redis
  • Fail open/closed
  • Dimensions
Level expectations
What interviewers expect by level
LevelExpectation
JuniorFixed window
MidToken bucket + Redis
SeniorMulti-region approx
StaffAdaptive limits
PrincipalMesh-wide policy engine
Expected answer shape
Algorithms (know 3)
  • Token bucket: refill rate r; burst capacity — industry default.
  • Leaky bucket: smooth constant outflow.
  • Fixed window: simple counters; edge burst problem.
  • Sliding window log/counter: fairer, more cost.
Diagram
Gateway + Redis token bucket
Step-by-step whiteboard
  1. Gateways call a shared store (Redis) before forwarding.
  2. Use atomic ops (INCR+EXPIRE or Lua) for token bucket — avoid races.
  3. On deny: HTTP 429 + Retry-After.
  4. Dimensions: per API key / IP / endpoint / tenant.
  5. Multi-region: regional limiters + global budget, or accept approximate limits.
  6. Redis down: product call — fail open vs fail closed.
Pseudo Redis check
TEXT
# token bucket keys: tokens={key}, ts={key}
# atomic Lua: refill based on elapsed time, consume 1 if tokens>=1
# else return limited
Follow-up questions
  • Per-user vs per-IP?
  • Burst vs smooth?
  • Redis down?
Common mistakes
Real-world production examples
  • AWS API Gateway
  • Cloudflare rate limiting
  • Stripe API limits
Q5. Design Uber / Ride Sharing

Design ride-hailing: riders request trips, nearby drivers are matched, locations update in realtime, pricing/ETA computed.

Asked at: Uber, Lyft, DoorDash-adjacent geo interviews · Difficulty: Hard · Pattern: Geo index · matching · trip state machine

Why interviewers ask this

~25 min to rehearse aloud

Geo + matching + state machines — Uber/Lyft signature.

What they are evaluating
  • Geo index
  • Double-dispatch
  • Trip FSM
  • City sharding
Level expectations
What interviewers expect by level
LevelExpectation
JuniorBasic nearby query
MidRing matching + ETA
SeniorSurge + CAS claim
StaffMulti-product dispatch
PrincipalMarketplace optimization
Expected answer shape
Clarify
  • Cities / regions in scope?
  • ETA accuracy expectations?
  • Surge pricing?
  • Driver app battery / update frequency?
Diagram
Geo index and ride matching
Step-by-step whiteboard
  1. Location stream: drivers send GPS every few seconds → update geo index (geohash / S2 cells in Redis or specialized store).
  2. Request: rider → query nearby cells → filter status/vehicle → rank by ETA/rating → offer with timeout → expand ring on miss.
  3. Double dispatch: atomic claim / CAS on driver status with lease; only one rider wins.
  4. Trip lifecycle: requested → matched → enroute → ongoing → completed (state machine + events to billing/notify).
  5. ETA: map-match + traffic-aware routing service; cache segments.
  6. Surge: demand/supply per cell, smoothed (EMA), capped rate of change.
  7. Scale: shard by city/region — traffic is local.
Follow-up questions
  • Surge?
  • ETA accuracy?
  • Airport queues?
Common mistakes
Real-world production examples
  • Uber/Lyft dispatch
  • DoorDash courier matching
  • Gojek regional stacks
Q6. Design YouTube / Video Streaming

Design video upload and streaming: users upload; millions watch with adaptive quality worldwide.

Asked at: Google, Netflix, Meta — storage + CDN heavy · Difficulty: Hard · Pattern: Transcoding pipeline · CDN · adaptive bitrate

Why interviewers ask this

~25 min to rehearse aloud

Pipeline + CDN — Google/Netflix media systems.

What they are evaluating
  • Async transcode
  • ABR
  • CDN hot path
  • Cost/tiering
Level expectations
What interviewers expect by level
LevelExpectation
JuniorUpload + single bitrate
MidLadder + CDN
SeniorLive vs VOD
StaffGlobal POP ingest
PrincipalEncoding marketplace
Expected answer shape
Diagram
Upload, transcode, CDN playback
Step-by-step whiteboard
  1. Upload: pre-signed URL → direct to object store; metadata = processing.
  2. Pipeline: queue workers transcode many resolutions/codecs, thumbs, duration → HLS/DASH segments → mark ready. Fast-start low-res first.
  3. Playback: client fetches manifest; CDN serves segments; origin is object store; ABR by bandwidth.
  4. Hot titles: heavy edge caching; short TTL for live.
  5. Live: separate ingest POPs → packager → CDN; not the VOD path.
  6. Cost: lifecycle to cold storage; fewer bitrates for rarely watched; copyright fingerprinting async.
  7. Recs: offline ML + online re-rank — off the play path.
Key principle
Follow-up questions
  • Viral cold cache?
  • DRM?
  • Thumbnails A/B?
Common mistakes
Real-world production examples
  • YouTube
  • Netflix encoding + Open Connect
  • Twitch live ladder
Q7. Design a Notification System

Design multi-channel notifications: push, email, SMS, in-app — with preferences, retries, and high throughput.

Asked at: Amazon, Meta, Uber, Slack · Difficulty: Medium · Pattern: Fan-out · priority queues · templates · DLQ

Why interviewers ask this

~18 min to rehearse aloud

Async fan-out with preferences — almost every company.

What they are evaluating
  • Channels
  • Prefs
  • Retries/DLQ
  • Idempotency
Level expectations
What interviewers expect by level
LevelExpectation
JuniorSingle channel worker
MidMulti-channel + prefs
SeniorPriority + chunking
StaffGlobal quiet hours/compliance
PrincipalNotification platform
Expected answer shape
Diagram
Notification fan-out pipeline
Step-by-step whiteboard
  1. Producers enqueue jobs (do not block product writes).
  2. Preferences/quiet-hours gate before send.
  3. Kafka topics by priority/channel → workers render templates → provider adapters (APNs/FCM, SES, Twilio).
  4. Idempotency keys; rate-limit per user and per provider.
  5. Retries with exponential backoff → DLQ for poison messages.
  6. Large audiences: chunked fan-out tasks.
  7. Aim at-least-once + idempotent display — not exactly-once fantasy.
Follow-up questions
  • Exactly-once?
  • Celebrity fan-out?
  • Digest bundling?
Common mistakes
Real-world production examples
  • Amazon SES+SNS
  • Uber notifications
  • LinkedIn notification service
Q8. Design Typeahead / Search Autocomplete

Design search autocomplete that returns top suggestions as the user types, with low latency and some trending awareness.

Asked at: Google, Amazon, Twitter · Difficulty: Medium · Pattern: Trie · top-k · edge cache

Why interviewers ask this

~15 min to rehearse aloud

Prefix systems + offline top-k — Google classic.

What they are evaluating
  • Trie/top-k
  • Offline vs online
  • Edge cache
  • Personalization light touch
Level expectations
What interviewers expect by level
LevelExpectation
JuniorIn-memory trie
MidSnapshots + CDN
SeniorTrending re-rank
StaffPersonalization + spell
PrincipalMulti-locale platform
Expected answer shape
Diagram
Prefix index autocomplete
Step-by-step whiteboard
  1. Offline: aggregate query logs → top-k per prefix → build trie/prefix index → ship snapshots to servers/edge.
  2. Online: client debounces; request prefix → memory trie returns top-k (<50ms); light personalization/trending re-rank.
  3. Cache popular prefixes at CDN/edge.
  4. Limit prefix length; store only top-k not full postings.
  5. Shard trie by first character(s) if needed.
  6. Refresh index on minutes cadence — not per keystroke.
Follow-up questions
  • Personalization?
  • Typo tolerance?
  • Abuse?
Common mistakes
Real-world production examples
  • Google Suggest
  • Amazon search box
  • Twitter typeahead
Q9. Design a Distributed Cache

Design a distributed in-memory cache: get/put/delete, TTL, HA, horizontal scale.

Asked at: Amazon, Microsoft, Oracle — Redis/Memcached style · Difficulty: Hard · Pattern: Consistent hashing · replication · eviction

Why interviewers ask this

~20 min to rehearse aloud

Distributed systems fundamentals — Amazon/Microsoft.

What they are evaluating
  • Consistent hashing
  • Replication
  • Stampede
  • CAP for cache
Level expectations
What interviewers expect by level
LevelExpectation
JuniorSingle Redis
MidShard + replica
SeniorHot keys + soft TTL
StaffMulti-region cache
PrincipalCache platform SLOs
Expected answer shape
Diagram
Consistent hashing ring
Step-by-step whiteboard
  1. Client or proxy uses consistent hashing → shard.
  2. Each shard: primary + replicas (async or semi-sync).
  3. Eviction: LRU/LFU + TTL per node.
  4. Membership via gossip/config service; virtual nodes for balance.
  5. Hot keys: replicate popular keys; local caches.
  6. Stampede: soft TTL + singleflight / probabilistic early expire.
  7. Write strategies: invalidate-on-write common; write-through / behind when justified.
  8. CAP: prefer AP for cache; miss → load DB.
  9. Persistence optional — usually ephemeral by design.
Follow-up questions
  • Write-through vs invalidate?
  • Persistence?
Common mistakes
Real-world production examples
  • ElastiCache/Memorystore
  • Netflix EVCache
  • Facebook Memcached fleet
Q10. Design Ticketmaster / Event Booking

Design ticketing for concerts: browse events, hold seats, pay, issue tickets — without double-selling under spikes.

Asked at: Amazon, Ticketmaster-style concurrency interviews · Difficulty: Hard · Pattern: Inventory locks · holds · idempotent payment

Why interviewers ask this

~22 min to rehearse aloud

Strong consistency under flash sales — inventory correctness.

What they are evaluating
  • Holds/TTL
  • CAS
  • Idempotent pay
  • Waiting room
Level expectations
What interviewers expect by level
LevelExpectation
JuniorRow lock booking
MidHold+pay saga
SeniorEvent shard + queue
StaffGlobal onsale fabric
PrincipalMarketplace inventory mesh
Expected answer shape
Diagram
Seat hold and checkout
Step-by-step whiteboard
  1. Browse: read replicas + CDN for event pages; seat maps cached carefully.
  2. Inventory states: available → held → sold.
  3. Hold: soft lock with short TTL (2–10 min) via Redis or conditional row update.
  4. Checkout: create hold → payment intent → on success commit seats + ticket IDs; on fail/expiry release hold.
  5. Idempotency: keys on payment webhooks — no double charge / double sell.
  6. Consistency: strong on inventory (CAS / UPDATE … WHERE status='available').
  7. Scale: shard by event_id; waiting rooms / queues for mega on-sales.
Strong closer
Follow-up questions
  • Overbooking airlines?
  • Seat maps cache?
Common mistakes
Real-world production examples
  • Ticketmaster
  • Amazon Lightning Deals inventory
  • Airline PSS holds
Q11. Design Dropbox / Google Drive

Design a cloud file storage and sync service: upload/download files, sync across devices, share folders, and handle large files efficiently.

Asked at: Meta, Amazon, Google, Microsoft — top file-storage design · Difficulty: Hard · Pattern: Chunked upload · sync · metadata vs blob

Why interviewers ask this

~22 min to rehearse aloud

Metadata vs blob + sync protocol — Dropbox/Drive interviews.

What they are evaluating
  • Chunking/dedupe
  • Conflict handling
  • Notify devices
Level expectations
What interviewers expect by level
LevelExpectation
JuniorUpload whole file
MidChunked hash sync
SeniorConflicts + sharing ACL
StaffBlock-level sync
PrincipalCollab editing add-on
Expected answer shape
Clarify
  • Max file size? Concurrent editors?
  • Version history? Offline sync?
  • Sharing ACLs / links?
Diagram
File metadata vs chunked blob storage
Step-by-step
  1. Split metadata and bytes: metadata DB (file_id, path, versions, ACL); blobs in object storage.
  2. Chunk files (e.g. 4MB); content-hash chunks for dedupe; upload only missing chunks.
  3. Sync protocol: client keeps local revision; pull delta since last sync; conflict → last-write-wins or branch versions.
  4. Notifications: long-poll / websocket for file-change events to other devices.
  5. Large uploads: multipart / resumable; commit metadata only when all chunks ACK'd.
  6. Sharing: ACL on folder nodes; link tokens with expiry.
Deep dives
  • Namespace tree sharding by owner_id.
  • CDC from metadata → search index.
  • Client block-level sync (rsync-like) for huge files.
Follow-up questions
  • Simultaneous edits?
  • Very large files?
Common mistakes
Real-world production examples
  • Dropbox
  • Google Drive
  • OneDrive
Q12. Design a Web Crawler

Design a distributed web crawler that discovers and fetches pages at large scale while respecting robots.txt and politeness limits.

Asked at: Google, Amazon — classic distributed systems question · Difficulty: Hard · Pattern: URL frontier · politeness · dedupe

Why interviewers ask this

~20 min to rehearse aloud

Distributed scheduling + politeness — Google classic.

What they are evaluating
  • Frontier
  • Dedupe
  • Per-host limits
  • Budget/priority
Level expectations
What interviewers expect by level
LevelExpectation
JuniorSingle crawler
MidDistributed frontier
SeniorFreshness/recrawl
StaffJS rendering farm
PrincipalWeb-scale crawl platform
Expected answer shape
Diagram
Distributed crawl frontier
Step-by-step
  1. URL frontier: prioritized queue of URLs to fetch (BFS / priority by PageRank estimate).
  2. Dedupe: seen URL set (Bloom + store); canonicalize URLs.
  3. Politeness: per-host rate limits; respect robots.txt (cache rules).
  4. Workers: fetch → extract links → enqueue new URLs; store raw HTML / parse text.
  5. Distributed: shard frontier by host hash so one host stays on one worker (politeness).
  6. Failure: retries, crawl budget, blacklist bad hosts.
Google flavor
Follow-up questions
  • JavaScript-heavy pages?
  • Change rates?
Common mistakes
Real-world production examples
  • Googlebot
  • Amazon product crawlers
  • Bing crawler
Q13. Design a Payment System

Design a payment service that charges cards, handles retries safely, supports refunds, and keeps an accurate ledger under failures.

Asked at: Stripe, PayPal, Amazon, Square — money-moving design · Difficulty: Hard · Pattern: Idempotency · ledger · saga / outbox

Why interviewers ask this

~25 min to rehearse aloud

Money systems — Stripe/Amazon bar for correctness.

What they are evaluating
  • Idempotency
  • Ledger
  • Webhooks
  • PCI boundary
Level expectations
What interviewers expect by level
LevelExpectation
JuniorCharge API + DB flag
MidIdempotent intents + ledger
SeniorSaga/outbox
StaffMulti-rail orchestration
PrincipalGlobal payments platform
Expected answer shape
Diagram
Idempotent payment and ledger
Step-by-step
  1. Idempotency keys on every charge from the client — retries must not double-charge.
  2. API: create PaymentIntent → confirm → capture (or auth+capture).
  3. Ledger: append-only double-entry journal; balances derived — never overwrite money rows.
  4. Provider calls: stripe/processor behind adapter; store provider refs; reconcile webhooks with signature verify.
  5. Distributed tx: transactional outbox or saga for order ↔ payment; compensating refunds on failure.
  6. PCI: never store raw PAN; use tokens; isolate network.
Strong signal
Follow-up questions
  • Partial capture?
  • Chargebacks?
  • Multi-currency?
Common mistakes
Real-world production examples
  • Stripe
  • PayPal
  • Amazon Payments
Q14. Design a Leaderboard

Design a game leaderboard that supports updating a player's score and fetching top-K and a player's rank with low latency.

Asked at: Amazon, Meta, gaming companies — realtime ranking · Difficulty: Medium · Pattern: Sorted sets · sharding · top-k

Why interviewers ask this

~12 min to rehearse aloud

Realtime ranking primitives — games + social.

What they are evaluating
  • ZSET ops
  • Shard strategy
  • Ties
Level expectations
What interviewers expect by level
LevelExpectation
JuniorOne Redis ZSET
MidSeason snapshots
SeniorSharded boards
StaffApprox global top-k
PrincipalTournament platform
Expected answer shape
Diagram
Redis sorted set leaderboard
Step-by-step
  1. Redis ZSET (score → member) for one board: ZADD update, ZREVRANGE top-K, ZREVRANK for rank — O(log n).
  2. Scale: shard by competition/season; or by player hash with aggregation for global top-K (harder).
  3. Ties: use score + timestamp composite.
  4. Historical boards: snapshot immutable ZSET per season.
  5. Fan-out reads with cache; writes go to primary.
Follow-up questions
  • Historical seasons?
  • Friends-only board?
Common mistakes
Real-world production examples
  • Game leaderboards
  • Duolingo leagues
  • Amazon bestseller ranks
Q15. Design a Distributed Key-Value Store

Design a Dynamo-style distributed key-value store with put/get, high availability, and horizontal scale.

Asked at: Amazon (Dynamo), Google — fundamentals of distributed DBs · Difficulty: Hard · Pattern: Consistent hashing · quorum · replication

Why interviewers ask this

~25 min to rehearse aloud

Dynamo paper literacy — Amazon/Google distributed DB.

What they are evaluating
  • Hash ring
  • Quorum R/W
  • Conflict versions
  • Anti-entropy
Level expectations
What interviewers expect by level
LevelExpectation
JuniorReplicated KV
MidTunable quorum
SeniorVector clocks
StaffMulti-datacenter
PrincipalStorage engine internals
Expected answer shape
Step-by-step
  1. Consistent hashing ring + virtual nodes for partition.
  2. N replicas on successor nodes; client or coordinator uses quorum R/W (e.g. N=3, R=2, W=2).
  3. Versioning: vector clocks / version numbers; reconcile conflicts (last-write-wins or client merge).
  4. Hinted handoff + anti-entropy (Merkle trees) for temporary failures.
  5. Tunable consistency: CAP — prefer AP with eventual consistency for shopping-cart style.
Diagram
Consistent hashing for KV shards
Contrast

Different from a cache: durability, replication, conflict resolution, and anti-entropy are first-class.

Follow-up questions
  • Why not Paxos always?
  • Sloppy quorum?
Common mistakes
Real-world production examples
  • Amazon DynamoDB lineage
  • Cassandra
  • Riak
Q16. Design a Distributed Message Queue (Kafka-like)

Design a pub/sub log that supports high-throughput producers, consumer groups, and durable retention.

Asked at: LinkedIn, Amazon, Uber, Confluent-style interviews · Difficulty: Hard · Pattern: Partitions · consumer groups · retention

Why interviewers ask this

~20 min to rehearse aloud

Log-based messaging — LinkedIn/Uber data infra.

What they are evaluating
  • Partitions/order
  • Consumer groups
  • Retention
  • ISR acks
Level expectations
What interviewers expect by level
LevelExpectation
JuniorSingle topic queue
MidPartitions + groups
SeniorExactly-once talk
StaffMulti-cluster mirror
PrincipalStreaming platform
Expected answer shape
Step-by-step
  1. Topics split into partitions (ordered append logs).
  2. Producers pick partition by key (ordering per key) or round-robin.
  3. Replicas: leader + followers; ack on ISR.
  4. Consumer groups: each partition → one consumer in the group; commit offsets.
  5. Retention by time/size; consumers are pull-based.
  6. Scale: more partitions; rebalance on membership change.
Diagram
Topic partitions and consumer group
Follow-up questions
  • Kafka vs RabbitMQ?
  • Reorder?
  • Poison messages?
Common mistakes
Real-world production examples
  • LinkedIn Kafka
  • Uber uReplicator era
  • Amazon MSK/Kinesis cousins
Q17. Design Pastebin

Design a pastebin: users paste text, get a unique URL, optional expiry and syntax highlighting.

Asked at: Amazon, Meta — easier SD warmup after URL shortener · Difficulty: Medium · Pattern: Object storage · short IDs · expiry

Why interviewers ask this

~10 min to rehearse aloud

Easier SD warmup after URL shortener.

What they are evaluating
  • ID + storage tier
  • Expiry GC
  • Abuse
Level expectations
What interviewers expect by level
LevelExpectation
JuniorDB paste
MidBlob for large
SeniorCDN + TTL
StaffEnterprise private pastes
Expected answer shape
Step-by-step
  1. Similar to URL shortener: generate short id; store content in object store or DB (small pastes in DB, large in blob).
  2. Metadata: id, expiry, visibility, user.
  3. CDN/cache for public pastes; rate-limit create.
  4. GC expired pastes with TTL sweeper.
  5. Optional: raw vs HTML view; password-protected pastes.
Follow-up questions
  • Syntax highlight?
  • Password pastes?
Common mistakes
Real-world production examples
  • pastebin.com
  • GitHub gists
  • Internal snippet tools
Q18. Design Google Maps (navigation basics)

Design the core of a maps/navigation product: show maps, find places, and compute routes with ETA.

Asked at: Google, Uber — geo + routing · Difficulty: Hard · Pattern: Map tiles · graph routing · ETA

Why interviewers ask this

~22 min to rehearse aloud

Geo + routing — Google Maps / Uber adjacency.

What they are evaluating
  • Tiles
  • Road graph
  • ETA traffic
  • Reroute
Level expectations
What interviewers expect by level
LevelExpectation
JuniorStatic route
MidA*/CH routing
SeniorTraffic-aware ETA
StaffLane-level / multimodal
PrincipalGlobal maps platform
Expected answer shape
Step-by-step
  1. Tiles: pre-render / vector tiles by zoom; CDN heavily.
  2. Places search: geospatial index + text (similar to typeahead + geo filter).
  3. Road graph: nodes/edges with travel times; Dijkstra / A* / contraction hierarchies for speed.
  4. ETA: traffic-aware edge weights updated nearline.
  5. Client: request route → server returns polyline + steps; reroute on deviation.
Tie-in

Shares geo indexing ideas with Uber matching (Q5) but routing graph is the heart.

Follow-up questions
  • Offline maps?
  • Traffic incidents?
Common mistakes
Real-world production examples
  • Google Maps
  • Apple Maps
  • Uber route service