Skip to main content

Backend engineer system design interview questions

30 questions on system design for backend engineer candidates. Expect prompts such as “Design Twitter's timeline feed” and “Design a URL shortener like bit.ly”, each with a worked answer outline and the follow-ups interviewers push on.

Questions

Showing 1 to 25 of 30 system design questions (page 1 of 2).

As asked

Design the backend for Twitter's home timeline. The system serves 500M monthly active users and must show recent tweets from followed accounts with low latency.

Sample answer outline

Two architectures to compare: fan-out-on-write (push: insert each new tweet into each follower's timeline cache - fast reads, expensive writes for high-follower accounts) vs fan-out-on-read (pull: query followed accounts at read time - flexible but slow). Real systems hybridise: fan-out-on-write for normal users, fan-out-on-read for celebrities (the Justin Bieber problem). Discuss storage (Redis for hot timelines, blob storage for media), caching layers, ranking, and the celebrity-account special case.

Expect these follow-ups

  • How do you handle a celebrity tweeting to 100M followers?
  • What is your cache invalidation strategy when a user unfollows?
  • How do you rank the timeline beyond pure recency?
fanoutcachingscale

As asked

Design a URL shortening service. It must accept long URLs and return short URLs, redirect short URLs to long ones with low latency, and support hundreds of millions of redirects per day.

Sample answer outline

Key generation: pre-generate a pool of 7-char base62 IDs (62^7 = 3.5T combinations) in a separate counter service, or use a hash of the URL truncated and checked for collisions. Storage: KV store keyed by short ID, with the long URL plus metadata (created_at, owner, click_count). Reads: cached in a CDN edge layer because redirect is the hot path. Writes: relatively rare. Discuss custom aliases, analytics, abuse prevention, and link expiry.

Expect these follow-ups

  • How do you prevent two users from picking the same custom alias simultaneously?
  • How do you handle a phishing link that spreads virally?
  • What if a long URL contains a session token - is shortening it a privacy issue?
kv-storecdnscale

As asked

Design a URL shortening service that handles 10,000 writes per second and 100,000 reads per second. Walk me through your data model, ID generation strategy, caching layer, and how you handle redirects at scale.

Sample answer outline

Use a distributed ID generator (Snowflake or a counter-based approach) to produce a unique integer, then base62-encode it to 7 characters. Store long-to-short mapping in Postgres with an index on the short code. Cache hot short codes in Redis with a long TTL (days) since most traffic is reads of popular links. Redirect using HTTP 301 (cacheable, browser caches it) vs 302 (non-cacheable, better for analytics). At 100k reads/s, Redis with consistent hashing across shards handles this comfortably. A strong answer discusses custom aliases, expiry, click analytics via async Kafka events, and multi-region caching.

Expect these follow-ups

  • How do you prevent short code collisions in a distributed ID generator?
  • How would you implement per-link analytics without slowing down the redirect path?
system-designcachingdatabasesscaling

As asked

Adobe Creative Cloud has over 30 million paying subscribers. Describe how your design and engineering approach changes when you know a feature will be used at that scale from day one, compared to building something for a few thousand internal users.

Sample answer outline

Strong answers cover progressive rollout strategies (feature flags, canary deployments), observability from day one (structured logging, real-user monitoring), designing for partial failures so one region or cohort does not take down the whole fleet, and understanding that performance regressions at this scale have real revenue consequences. A great candidate also mentions backward compatibility and how a bad update to Photoshop or Lightroom can break professional workflows globally.

Expect these follow-ups

  • How do you handle a hot path where 1% of requests come from 30% of your traffic?
  • What is your rollback strategy if a deploy breaks a rendering pipeline?
company:adobescalecreative-cloudsystem-designreliability

As asked

Design the backend system that powers Airbnb's listing search. A guest enters a location, dates, and guest count. Walk me through how you would retrieve, filter, and rank listings at scale. Assume tens of millions of active listings globally.

Sample answer outline

A strong answer covers: geo-spatial indexing (PostGIS or Elasticsearch geo queries) for location filtering, availability indexing (calendar bitmap or a separate availability service) for date filtering, a two-phase retrieval-then-ranking pipeline, and a ranking model that combines price, reviews, availability probability, and personalization signals. The candidate should discuss consistency vs. latency tradeoffs in the availability check, and how to handle the cold-start problem for new listings.

Expect these follow-ups

  • How do you handle the availability calendar when a host blocks dates in real time while a search is in flight?
  • Walk me through how you would A/B test a change to the ranking model.
company:airbnbsystem-designsearchrankinggeoscalability

As asked

Design the system that handles an Airbnb booking from the moment a guest clicks 'Reserve' to the moment the host's payout is released after checkout. Focus on correctness, consistency, and failure handling.

Sample answer outline

Strong answers identify the core challenge as a distributed transaction spanning inventory (availability), payment authorization, and notification. They describe an optimistic lock on the listing calendar, a saga pattern or two-phase commit for the payment flow, idempotency keys for retries, and a state machine for the reservation lifecycle (pending, confirmed, checked-in, completed, cancelled). The candidate should address what happens when payment succeeds but the database write fails.

Expect these follow-ups

  • How do you handle double-booking when two guests book the same listing at the exact same millisecond?
  • When the host cancels after payment is captured, walk me through every system that needs to update.
company:airbnbsystem-designdistributed-systemstransactionspaymentsconsistency

As asked

Design a URL shortener service. It needs to handle 100 million new URLs per day and serve redirect requests at 10x that volume. Walk me through your high-level design, your choice of data store, and how you ensure low latency on the redirect path.

Sample answer outline

A strong answer starts with back-of-envelope math: 100M writes per day is about 1,200 writes/s, and 10x reads gives 1B reads per day, which is about 11,500 reads/s. The candidate should separate the write path (hash generation, storage) from the read path (cache-heavy, low latency). Key decisions include: base62 encoding of an auto-increment ID or MD5 prefix for the short code, a SQL or NoSQL store (DynamoDB fits well at Amazon), a distributed cache (ElastiCache/Redis) in front of the DB for the redirect path, and a CDN for the most popular URLs. Candidates should mention what happens on a hash collision.

Expect these follow-ups

  • How do you handle custom short codes that a user picks?
  • How would you add analytics to track click counts without impacting redirect latency?
company:amazonsystem-designamazon-sdcachingdistributed-systemsdatabases

As asked

Design the sync system that keeps photos consistent across a user's iPhone, iPad, Mac, and iCloud. Focus on conflict resolution, offline support, and bandwidth efficiency.

Sample answer outline

A strong answer treats the device as the source of truth per photo, identifies each photo by a stable UUID, and uses last-write-wins at the asset level since photos are immutable once captured. Conflict resolution is simpler than for text because photos do not merge: if the same UUID appears on two devices with different content, the one with the later capture timestamp wins. Bandwidth efficiency needs delta sync (upload only new assets), HEIC compression, and thumbnail-first loading. Offline support requires a local queue of pending operations that replay on reconnect. The candidate should touch on how to handle device key loss in end-to-end encryption scenarios.

Expect these follow-ups

  • How do you handle the case where a user deletes a photo on one device while it is being downloaded on another?
  • How does your design change if you need to sync edits to a photo, not just the original?
company:applesystem-designsyncdistributed-systemsicloud

As asked

Design the backend system that powers TikTok's For You Page. A user opens the app and within 200ms sees a ranked, personalized feed of short videos. Walk me through every major component from the client request to the videos appearing on screen.

Sample answer outline

A strong answer covers the candidate pipeline (retrieval from a candidate pool using collaborative filtering and content signals), the ranking model (a two-tower or multi-task neural model scoring candidates), a pre-computation layer that generates candidate sets offline for every user, and a serving layer that merges pre-ranked candidates with real-time signals at request time to meet the 200ms SLA. The candidate should also address cold start for new users and new videos, diversity injection to avoid filter bubbles, and how the feedback loop (watch time, likes, shares) flows back into retraining.

Expect these follow-ups

  • How do you handle the cold start problem for a brand new creator who just posted their first video?
  • How do you A/B test a new ranking feature without degrading the overall user experience?
company:bytedancerecommendation-systemfeed-rankingtiktoktwo-towerreal-time

As asked

Design the system that handles video uploads for a platform at TikTok's scale. A user uploads a raw video from their phone, and within a few minutes that video must be available in multiple resolutions and formats across the globe. Walk through the full pipeline.

Sample answer outline

The answer should cover chunked resumable upload to object storage (S3 or equivalent), an async transcoding pipeline triggered by upload completion (using a job queue like Kafka), parallel transcoding workers producing HLS or DASH at multiple bitrates, CDN distribution for global playback, and a status-tracking system the app polls or subscribes to. Strong candidates mention checksums for upload integrity, auto-retry for failed transcode jobs, and the difference between near-real-time preview quality (a fast low-res transcode) and full-quality transcode.

Expect these follow-ups

  • How do you handle a 1-hour raw video from a creator's desktop versus a 30-second clip from a phone?
  • How do you detect and reject policy-violating content before making it public?
company:bytedancevideo-processingtranscodingobject-storageasync-pipelinecdn

As asked

Design a rate limiter that enforces 1000 requests per minute per user IP across all of Cloudflare's 300-plus data centers. Walk me through the data model, the consistency trade-offs, and how you would handle the thundering herd when a limit is exceeded.

Sample answer outline

A strong answer considers three approaches: local counting per PoP (fast, under-counts globally), global counting via a central store (accurate, adds latency), and a sliding window approximation using Durable Objects or a token-bucket pushed to the edge via KV. Cloudflare's own Rate Limiting product uses a distributed approximate counting approach where each PoP tracks local counts and syncs periodically, accepting slight over-counting in exchange for sub-millisecond decisions. Candidates should mention the sliding window log vs fixed window trade-offs, and what happens at rollover boundaries.

Expect these follow-ups

  • How would your design change if the limit was per account rather than per IP?
  • What does the response look like to the client when a limit is hit, and how do you avoid retry storms?
company:cloudflarerate-limitingdistributed-systemssystem-designcloudflare-workers

As asked

A user requests a crypto withdrawal. Your system must ensure the same funds cannot be spent twice, even if two withdrawal requests arrive simultaneously and the database write and the blockchain broadcast are not atomic. Walk me through how you would design this.

Sample answer outline

A strong answer introduces an idempotency key on the request, a state machine for withdrawal lifecycle (pending, reserved, broadcast, confirmed, failed), and a pessimistic lock or SELECT FOR UPDATE on the balance row before decrementing. The candidate should explain why optimistic locking is riskier here than in typical CRUD, discuss how to handle the gap between DB commit and chain broadcast using an outbox pattern or at-least-once worker with idempotent broadcast, and address what happens on timeout or partial failure.

Expect these follow-ups

  • How does your design change if you need to support withdrawals across multiple chains with different confirmation times?
  • What happens if the blockchain node your system talks to goes down after you deduct the balance but before broadcast?
company:coinbasesystem-designfinancial-systemsidempotencydistributed-systemscrypto

As asked

Design a system that ingests time-series metrics from 100,000 hosts, each emitting 1,000 metrics every 10 seconds. The system must store metrics for 15 months, support fast range queries for dashboards, and handle a 10x traffic spike without dropping data. Walk me through your architecture.

Sample answer outline

A strong answer describes the ingestion layer (agents, protocol choice between StatsD/OpenTelemetry, connection pooling), a durable buffer (Kafka or similar) to absorb spikes, a write path that aggregates at the edge before writing to a columnar or time-series store (InfluxDB, TimescaleDB, or a custom LSM-based store), a tiered retention strategy (high-resolution for recent data, downsampled for older), and a read path that answers range queries efficiently using pre-computed rollups. The candidate should reason explicitly about cardinality limits and tag index cost.

Expect these follow-ups

  • How does your design change if you also need to support 1-second resolution for the most recent hour?
  • How would you handle a customer who creates a metric with 10 million unique tag combinations?
company:datadogsystem-designtime-seriesmetrics-pipelinescalabilitykafka

As asked

Design Datadog's APM distributed tracing system from scratch. I need it to collect traces from thousands of microservices, correlate spans into complete traces, store them efficiently for 30 days, and let users query by service, operation, error status, and latency percentile in near real time.

Sample answer outline

A strong answer covers trace context propagation (W3C TraceContext or B3 headers), agent-side head-based and tail-based sampling strategies and their tradeoffs, a collection tier that reassembles incomplete spans using a trace ID keyed buffer, a write path to a wide-column or columnar store optimized for trace assembly, and a query path that supports filtering by service graph edges. The candidate should address the fundamental tension between sampling (cost control) and completeness (not missing rare errors).

Expect these follow-ups

  • How does tail-based sampling differ from head-based sampling, and what infrastructure does it require?
  • How would you store span data so you can answer 'show me all traces with p99 latency over 500ms in the last hour' in under 2 seconds?
company:datadogdistributed-tracingsystem-designapmsamplingstorage

As asked

DoorDash has tens of thousands of Dashers on the road at peak hours. Design the backend system that tracks Dasher location in real time, detects when a delivery is at risk of being late, and triggers automated interventions like reassignment. Walk me through your data model, your event pipeline, and how you handle the case where a Dasher goes offline mid-delivery.

Sample answer outline

Strong answers define a location event pipeline (Kafka or Pub/Sub) ingesting GPS pings at 5 to 10 second intervals, a stateful stream processor computing ETA vs. promised delivery time, and a risk-scoring service that fires reassignment events when the gap exceeds a threshold. The candidate should address geo-spatial indexing (PostGIS or H3), at-least-once delivery guarantees, and the consumer-offline edge case using a heartbeat timeout with graceful handoff logic rather than immediate reassignment.

Expect these follow-ups

  • How does your design change at 10x Dasher volume during a Super Bowl peak?
  • How would you A/B test a new reassignment threshold without hurting real customers?
company:doordashreal-timekafkageo-spatialreliabilityevent-driven

As asked

Design the system that keeps a user's files consistent across all their devices. Focus on the data flow when a file changes on one device and needs to propagate to others. Assume hundreds of millions of files and tens of millions of daily active users. Walk me through every component you would build.

Sample answer outline

A strong answer covers: chunking files into 4MB blocks and hashing each block (content-addressable storage) so only changed chunks are uploaded; a metadata service that stores file version history, block lists, and device cursors (what each device last synced); a notification service (long-poll or WebSocket) to push change events to other devices; block storage on S3 with CDN for downloads; a conflict resolution strategy (Dropbox creates conflicted copies rather than auto-merging); and the sync client algorithm (upload new blocks, update metadata, pull changes for other devices). The candidate should discuss eventual consistency and what happens during partition.

Expect these follow-ups

  • How do you handle a 50GB file where only 10 bytes changed?
  • How do you decide the optimal chunk size, and what are the tradeoffs of smaller versus larger chunks?
company:dropboxfile-syncdistributed-storagedropbox-domainsystem-design

As asked

Figma supports real-time collaborative editing where dozens of people can edit the same file simultaneously. Walk me through how you would design the data synchronization layer for this. How do you handle conflicts when two users move the same object at the same time?

Sample answer outline

A strong answer covers operational transformation or CRDTs as the two main approaches, explains why Figma uses a server-authoritative model with a central server that serializes all operations rather than a pure peer-to-peer CRDT approach, and discusses the tradeoff between complexity and correctness. The candidate should explain how vector clocks or sequence numbers track causality, how the client applies optimistic local updates and rolls back on conflict, and how presence (cursors, selection highlights) is handled as ephemeral state separate from document state. They should mention that Figma publishes engineering posts explaining their choices.

Expect these follow-ups

  • If the server goes down mid-edit, how does a client know which local operations were acknowledged?
  • How would you handle the case where one user deletes a frame that another user is actively editing inside of?
company:figmacrdtreal-time-syncmultiplayersystem-designconflict-resolution

As asked

Design a real-time collaborative document editing system similar to Google Docs. Multiple users should be able to edit the same document simultaneously, see each other's cursors, and have a consistent view of the document at all times. Walk me through your architecture.

Sample answer outline

A strong answer covers operational transformation (OT) or CRDT as the conflict resolution mechanism, explains the difference, and picks one with justification. The architecture should include a document server, a presence/cursor service, durable storage (document snapshots plus operation log), and a WebSocket or long-polling layer for real-time updates. The candidate should address consistency (what happens when two edits arrive out of order), persistence (how to reconstruct a document from its operation log), and latency (optimistic local application before server confirmation).

Expect these follow-ups

  • How would you handle the case where a user goes offline for 5 minutes then reconnects?
  • How do you support the revision history feature that lets users rewind to any point in time?
company:googlesystem-designcollaborationcrdtreal-time

As asked

Design a URL shortening service similar to what Google built with goo.gl (now shut down). Users submit a long URL and get back a short URL. When someone visits the short URL, they are redirected to the original. The service must handle 1 billion URLs and 100,000 redirect requests per second globally. Describe your architecture.

Sample answer outline

A strong answer covers: generating short codes (base62 encoding of a counter or hash, with collision handling), storing the mapping (a key-value store like Bigtable or Spanner with the short code as the key), serving redirects via a CDN-cached layer for popular URLs with a hot cache for the long tail, and handling the write path with a counter or distributed ID generator. The candidate should address analytics (click counting) as a separate asynchronous write to avoid slowing redirects.

Expect these follow-ups

  • How do you prevent collisions if you are using a random hash?
  • How would you add custom aliases, like goo.gl/myAlias, without slowing down the lookup?
company:googlesystem-designkey-value-storecachingurl-shortener

As asked

Design the system that powers LinkedIn's home feed: each member sees a ranked, paginated list of updates from their connections and followed entities, with roughly 900 million members and hundreds of millions of daily active users. Walk me through your architecture.

Sample answer outline

A strong answer covers fan-out strategy (push vs pull vs hybrid based on follower count), a ranking service that applies machine-learning signals (relevance, recency, engagement), a timeline store (Kafka for event ingestion, distributed key-value for precomputed timelines), and CDN/caching layers. The candidate should call out the celebrity problem (high-degree nodes), stale feed risk, and how to handle real-time vs eventual consistency for feed updates.

Expect these follow-ups

  • How would you handle a member with 10 million followers posting an update?
  • How does your design degrade gracefully when the ranking service is slow or down?
company:linkedinsystem-designfeeddistributed-systemscaching

As asked

Design Lyft's ride-matching service. When a rider requests a ride, the system needs to match them to a driver in real time. Walk me through your data model, the matching algorithm, and how you handle edge cases like no available drivers, surge zones, and network partitions.

Sample answer outline

Strong answers cover geospatial indexing (geohash or quadtree for nearby driver lookup), a scoring function that weighs distance, ETA, and driver rating, a queuing or polling mechanism for driver state, and eventual-consistency trade-offs when partitions occur. They should also address how to handle the case where a driver goes offline between match and acceptance.

Expect these follow-ups

  • How would you change the design if Lyft moved from a driver-accept model to auto-dispatch?
  • How do you prevent the same driver from being matched to two riders simultaneously?
company:lyftsystem-designgeospatialreal-timemarketplacelyft-core

As asked

Design the News Feed system for Facebook. Start with clarifying questions, walk me through the high-level architecture, then go deep on the feed generation and ranking components.

Sample answer outline

A strong answer covers the fan-out write model versus fan-out read, when to use each (celebrities versus normal users), the role of a feed store like TAO or a cache like Memcached, and how ranking scores are computed offline versus online. The candidate should discuss the trade-off between freshness and ranking quality, and how you handle users with millions of followers without blowing up write amplification.

Expect these follow-ups

  • How does your design change if you add Stories on top of Feed with a 24-hour expiry?
  • Walk me through what happens when a user with 50 million followers posts.
company:metasystem-designfeedscalingmeta-product

As asked

Design the backend for a messaging product like Messenger or WhatsApp. Focus on message delivery guarantees, real-time presence, and how you handle a user receiving messages across multiple devices.

Sample answer outline

A strong answer covers the message store (append-only log per conversation, similar to Scribe), the use of long-polling or WebSockets for real-time delivery, how delivered and read receipts are tracked without blocking the sender, and how multi-device fanout works. The candidate should explain exactly-once delivery semantics and how deduplication is achieved with client-side idempotency keys.

Expect these follow-ups

  • How do you handle end-to-end encryption without breaking your server-side search and moderation features?
  • What happens when a user comes back online after being offline for three days?
company:metasystem-designmessagingreal-timewebsockets

As asked

Microsoft makes OneDrive. Design a cloud file storage service that supports uploading and downloading files up to 5 GB, organizing them in folders, sharing with other users at different permission levels, and syncing changes across multiple devices. Walk me through the components you would build.

Sample answer outline

Strong answers cover the metadata service (file hierarchy, permissions, versioning) separately from blob storage (chunked upload via Azure Blob or S3-equivalent, deduplication). The sync protocol should address conflict resolution, delta sync, and client-side chunking. Sharing needs an ACL model. The candidate should call out CDN usage for popular downloads, handle resumable uploads for large files, and discuss how change notifications propagate to devices. Candidates interviewing at Microsoft should tie this to Azure infrastructure where natural.

Expect these follow-ups

  • How do you handle conflict resolution when two devices edit the same file offline?
  • How would you support 100 million concurrent users without degrading sync latency?
company:microsoftsystem-designblob-storagesyncazure

As asked

Design the backend for a real-time messaging system similar to Microsoft Teams. It needs to support direct messages and group channels, message persistence, delivery guarantees, read receipts, and push notifications to mobile and desktop clients. Start with requirements and scale from there.

Sample answer outline

The candidate should separate the messaging write path from the read path. WebSockets or SignalR handle real-time delivery. A fan-out-on-write model works at small team scale but a fan-out-on-read model is better for large channels. Message storage needs an append-friendly store like Cassandra or CosmosDB. Push notifications require a notification service layer decoupled from the main write path. Read receipts can be handled with eventual consistency. The candidate should address what happens when a client is offline.

Expect these follow-ups

  • How do you guarantee message ordering within a channel?
  • How would you scale to a channel with 10,000 members?
company:microsoftsystem-designwebsocketspub-submessaging