System design interview questions
Reason about APIs, state, scale, and reliability. 144 walkthroughs cover APIs, storage, messaging, scheduling, caching, and reliable delivery.
Work through a complete design.
From the API contract to failure behavior.
Design a distributed rate limiter
Token buckets, atomic decisions, hot keys, and regional budgets.
Design a URL shortener
Allocate codes safely, accelerate redirects, and make revocation and analytics explicit.
Design a chat system
Separate durable messages from connections, and reason about ordering, retries, and offline delivery.
Design a news feed
Compare push and pull fan-out, handle hot authors, and keep visibility checks current.
Design a file-storage service
Coordinate resumable uploads, metadata, versions, and revocable access.
Design a web crawler
Schedule polite fetches, bound untrusted inputs, and build a useful revisit policy.
Design a distributed cache
Choose a consistency contract, prevent stampedes, and plan for the moment the cache disappears.
Message Queue System Design: Delivery, Retries and Backlog
Design a durable message queue with at-least-once delivery, idempotent effects and worker leases. Calculate backlog recovery and the capacity consumed by retries.
Design a distributed job scheduler
Separate schedules from executions, claim work safely, and fence workers that have lost ownership.
Design an inventory reservation system
Prevent overselling with atomic state transitions, explicit expiry, and reconciliation for uncertain outcomes.
Design a notification delivery service
Track durable intent, provider attempts, user preferences, and ambiguous delivery outcomes.
Design a search autocomplete service
Serve fresh prefix suggestions with predictable latency, careful normalization, and bounded personalization.
Design a metrics ingestion platform
Control cardinality, distinguish event time from arrival time, and preserve meaning through aggregation.
Design a video streaming service
Separate upload processing from playback, and reason about encoding, cacheability, and access control.
Design a reliable webhook delivery platform
Make delivery durable, bound retries, and explain why an acknowledgement cannot prove exactly-once processing.
Design a coding-agent execution platform
Separate reasoning from execution and make permissions, retries, and recovery part of the architecture.
GPU Scheduler System Design: Fairness and Preemption
Design a GPU scheduler with quota admission, gang placement, checkpoint recovery and fair sharing. Calculate fragmentation and the cost of preemption.
Distribute and safely activate a large model
Find the bandwidth bottleneck, verify immutable chunks, and separate downloaded bytes from safe production activation.
Device Configuration Sync: Offline Conflicts and Recovery
Design configuration synchronization across offline devices using revisions, conflict handling and desired versus applied state. Work through reconnect failures.
Ad Frequency Capping System Design: Rolling Windows and Races
Design ad frequency capping with atomic admission, rolling windows and retry deduplication. Work through cap changes, race conditions and failure policy.
Handle oversized inputs in a shared AI playground
Bound uploads, extraction and token work while preserving permissions, provenance and honest completeness guarantees.
Design a change-data-capture pipeline
Connect snapshots to live changes, make replay safe, and calculate the cost of falling behind.
Design token usage accounting and reconciliation
Reserve budgets before execution, meter streaming work and reconcile retries without double charging.
Design an experimentation assignment and exposure platform
Deterministic assignment, enrollment, exposure semantics, telemetry loss and experiment quality.
Design a double-entry payment ledger
Worked wallet entries, atomic holds, idempotent posting and ledger recovery.
Collaborative Editor System Design: CRDTs, Sync and Presence
Design a collaborative editor with CRDT updates, durable synchronization and bounded presence traffic. Calculate fan-out and handle offline clients safely.
Design distributed training checkpoint storage
Immutable staging, atomic publication, checkpoint bandwidth and tested restoration.
Distributed Lock System Design: Leases and Fencing
Design distributed locks with lease expiry, atomic fencing checks and safe recovery. Work through stale workers, duplicate writes and external-service limits.
Design a schema registry for event producers
Directional compatibility, transitive checks, registration races and cache recovery.
Design resumable browser event streams
Replay boundaries, application checkpoints, fan-out and slow clients.
Design tiered time-series retention and downsampling
Mergeable summaries, counter resets, late revisions and tiered queries.
Design conversation history storage at scale
Immutable message trees, conditional branch updates, pagination and deletion fencing.
Tamper-Evident Audit Log System Design: Integrity and Gaps
Design a tamper-evident audit log with signed manifests, independent checkpoints and verifiable exports. Distinguish integrity from capture completeness.
Design a cross-shard transaction coordinator
Two-phase commit, fenced decisions, prepared-state recovery and visibility contracts.
Move a live tenant between database shards
Snapshot barriers, durable replay, writer fencing and honest rollback guarantees.
Object Storage Garbage Collection: Safe Deletion and Races
Design blob garbage collection with complete retention roots, atomic deletion checks and immutable generations. Analyze restore races and reclamation capacity.
Allocate sortable identifiers across regions
ID bit budgets, disjoint allocation grants, clock behavior and UUID trade-offs.
Limit concurrent work across service instances
Distributed permits, executor admission, fairness and oversubscription failures.
Design point-in-time database recovery
Recovery points, missing logs, retention dependencies and safe cutover.
Deliver messages at a future time
Time buckets, clock bounds, generation checks and overdue recovery.
Allocate released reservations to a waitlist
A transactional waitlist with explicit FIFO policy, acceptance races and holding-cost calculations.
Route around failing service dependencies
Scoped probes, survivor capacity, correlated failures and controlled recovery.
Generate resumable customer data exports
Snapshot lifetime, immutable parts, atomic manifests and revocable download access.
Build and atomically switch a distributed search index
Snapshot replay, revision fences, readiness barriers and stable pagination.
Multi-Region Quota Design: Budgets and Safe Transfers
Enforce a global tenant quota with regional budgets, atomic debits and idempotent transfers. Analyze lost acknowledgments, partitions and stranded capacity.
Group incoming email into reliable conversations
Message identities, missing parents, reversible merges and mailbox authorization.
Roll out server configuration safely
Atomic bundles, rollback revisions, compatibility and measured rollout exposure.
Fail over a regional write service safely
Partition timelines, recovery-point uncertainty, recovery budgets and external effects.
Design a live-event streaming service
Segment publication, CDN capacity, live-delay budgets and timeline continuity.
Allocate scarce capacity through a sealed auction
Deadline semantics, deterministic ties, payment uncertainty and hot-auction capacity.
Invalidate mutable content across edge caches
HTTP freshness, generation watermarks, purge acknowledgments and origin amplification.
Design a reproducible build artifact cache
Hermetic action identity, trusted publication, incomplete results and critical-path savings.
Compact an event log without resurrecting deleted keys
Tombstones, stale checkpoints, consistent snapshots and net catch-up capacity.
Resume long-running business workflows
History replay, lost acknowledgments, compensation, upgrades and capacity.
Rotate service certificates without interrupting traffic
Dual-root migration, expiry bounds, session state, recovery and compromise response.
Find nearby available resources at scale
Spatial candidates, exact distance, index lag, eligible top-k and reservation races.
Compute trending items from distributed streams
Partitioning proofs, aligned windows, heavy-hitter bounds and exact ranking certificates.
Book meetings across changing calendars
Interval exclusion, daylight-saving recurrence, atomic edits and external calendar limits.
Design a distributed tracing ingestion service
Trace affinity, tail buffers, durable replay and sampling-biased metrics.
Change a large database schema without stopping writes
Coordinate old and new writers, backfill without stale overwrites, and define the point where rollback becomes lossy.
Capture a consistent distributed snapshot
Account for in-flight transfers, establish a consistent cut, and publish only a complete durable snapshot.
Design a container artifact registry
Publish complete container images with resumable uploads, digest integrity, repository authorization and safe retention.
Join two event streams with late arrivals
Join out-of-order events with explicit retention, provisional unmatched results and replay-safe historical corrections.
Permission Revocation System Design: Caches, Leases and Streams
Design bounded permission revocation across gateways and caches. Analyze authority leases, stale refreshes, in-flight responses and signed-URL bypasses.
Count reactions across regions
Separate unique reaction state from replicated totals, handle retries and undo, and rebuild counts under skew and regional failures.
Execute analytical queries across workers
Plan analytical joins, budget shuffle and memory, handle hot keys, and recover tasks without duplicating results.
Erasure-Coded Storage Design: Capacity and Repair
Design erasure-coded object storage with a worked 6+3 layout, failure-domain placement, acknowledgment policy and generation-safe repair.
Distributed Deadlock Detection: Wait-for Graphs and Recovery
Detect distributed deadlocks with versioned wait-for graphs, stale-edge checks and coordinator-owned aborts. Distinguish deadlock from starvation and timeouts.
Bound retries across a service call chain
Assume idempotent reads, a 900 ms end-to-end deadline and no guarantee that a timed-out attempt stopped executing.
Schedule mixed-cost tenant jobs fairly
Assume jobs can be divided into bounded execution quanta, tenant identity is authenticated and fairness is measured in worker-seconds.
Route requests with stable hashing during fleet changes
Assume cache loss is harmless and durable documents live elsewhere.
Skip absent-key disk reads with Bloom filters
Assume immutable table generations and a standard Bloom filter with no deletion.
Locate replica differences with Merkle trees
Assume deterministic serialization, collision-resistant hashes and versioned records with a documented conflict resolver.
Cache missing DNS names without prolonging an outage
Assume an upstream recursive resolver and standards-compliant authoritative answers.
Claim unique public usernames under contention
Assume a single authoritative transactional store per normalized name.
Aggregate latency percentiles without averaging percentiles
Assume nonnegative latencies, explicit time windows and a mergeable quantile sketch with documented rank-error behavior.
Deliver short-lived database credentials to workers
Assume workers have a trusted workload identity and the database can enforce credential revocation.
Design single-use password reset links
Assume an existing account and email-delivery system.
Keep a user's reads from moving backward across replicas
Assume one ordered replication history per shard and a verifiable applied position.
Batch durable commits without acknowledging volatile data
Assume a write-ahead log and a storage stack that correctly implements the required flush semantics.
Bound database concurrency behind a connection pool
Assume short transactional requests with a bounded database concurrency target.
Count distinct identifiers across overlapping partitions
Estimate daily distinct device IDs across regions without retaining every ID centrally.
Estimate hot-key frequencies with bounded sketch memory
Track query frequencies in a stream with millions of distinct strings using bounded memory.
Detect concurrent document versions with vector clocks
Two offline editors update the same document.
Discover membership failures without treating suspicion as proof
A thousand-node service needs a scalable membership view during packet loss.
Budget compaction without starving storage writes
An LSM-based store accumulates immutable files faster than it can compact them.
Skip irrelevant row groups in analytical scans
A query engine reads terabytes to answer selective date-and-region queries.
Commit concurrent changes to an object-store table
Two jobs update overlapping partitions of a table stored as immutable files.
Explain what overlapping read and write quorums guarantee
A replicated key-value store uses N=3, W=2 and R=2.
Publish generated files with atomic name replacement
A service regenerates a configuration file while readers open it continuously.
Generate bounded image variants on demand
Serve resized product images through a CDN without allowing arbitrary transformation URLs to exhaust compute and cache storage.
Drain long-lived connections during a rolling upgrade
Upgrade a fleet of WebSocket gateways without abruptly dropping every active client or waiting forever for connections that never close.
Resume downloads without mixing object versions
A client resumes a large interrupted download while the server may replace the file.
Prevent lost edits with conditional HTTP updates
Two administrators edit the same resource from old browser tabs.
Rotate encryption keys without rewriting every object
A tenant stores millions of encrypted blobs.
Recover distributed shuffle outputs after worker failure
A distributed analytics job loses a worker holding intermediate partitions.
Estimate a workflow deadline from its dependency graph
A team adds workers to a pipeline but completion time barely changes.
Assign players to matches without double booking
Match players by skill and acceptable latency while queue time grows.
Pace campaign spending under delayed usage reports
An ad campaign must spend throughout a day without exceeding an authorized budget when auction charges arrive late.
Assemble daily digests from late and repeated events
Send one useful daily digest per user from many events, respecting time zones and preferences without duplicating content after retries.
Manage browser push subscriptions through expiry and renewal
Deliver browser push notifications when devices rotate subscriptions, remain offline or revoke permission.
Deduplicate backups when bytes shift within files
A backup service sees large files with small insertions.
Find deployments affected by a dependency advisory
A dependency advisory arrives.
Trace downstream datasets after an upstream correction
A source table was wrong for two days.
Prevent starvation in a priority work service
Urgent jobs continually arrive and normal jobs never run.
Evaluate dependent feature flags consistently within a request
A request reads several feature flags while their configuration changes.
Publish database changes through a transactional outbox
A service commits an order but crashes before publishing its event.
Protect a cross-row invariant from write skew
Two operators can independently disable service replicas, but at least one replica must remain enabled.
Reduce read-tail latency with bounded hedging
A replicated read service has occasional slow replicas.
Isolate slow dependencies with bulkheads
One optional downstream service consumes every worker and makes unrelated endpoints fail.
Adapt in-flight limits from latency feedback
A service's safe concurrency changes with request cost.
Aggregate many downstream reads under one deadline
An endpoint fans out to 100 shards.
Process leased queue messages without duplicate effects
A task runs longer than its queue visibility timeout and another worker receives it.
Set a defensible idempotency retention window
An API deduplicates retries for one day.
Correlate asynchronous callbacks to the right workflow attempt
An external system calls back hours after a workflow task timed out and retried.
Track email delivery failures and suppression
Build an email-status service that distinguishes send acceptance, delivery, bounce and complaint while avoiding repeated sends to invalid addresses.
Fetch link previews without trusting arbitrary URLs
A chat app wants titles and thumbnails for user-supplied URLs.
Emit stable geofence entry and exit events
GPS observations oscillate near a boundary and produce repeated arrival notifications.
Insert a rider into an existing pooled route
Match a new ride request to vehicles without violating existing riders' capacity, pickup or detour promises.
Reconcile parking-space occupancy from conflicting sensors
A parking service receives gate counts and per-space sensors that disagree.
Run an authoritative multiplayer simulation loop
Design a server simulation that receives irregular client inputs while maintaining reproducible game-state progression.
Publish seasonal rankings with explicit tie rules
Design a leaderboard with tied scores, late score updates and a season-close deadline that users can audit.
Copy a changing directory tree with a resumable manifest
Move millions of files between stores while failures and source changes occur.
Recover from missed filesystem watch events
A file-indexing service relies on change notifications, but its event queue overflows.
Evolve a binary message format safely
Old and new clients exchange serialized messages during a rolling upgrade.
Enforce purpose-specific consent in asynchronous processing
A user revokes permission while data is queued for an optional analytics job.
Batch warehouse picks under route and cart constraints
A warehouse wants shorter picking routes without mixing customer orders or overloading carts.
Verify deployment artifacts against an identity policy
A deployment platform receives a signed container image.
Roll out an authoritative DNS zone change
Change a service's DNS records across authoritative servers and explain why a successful update does not immediately move every client.
Propagate backpressure through a streaming pipeline
A producer is faster than a network consumer and memory grows continuously.
Serve materialized views with an explicit freshness contract
An analytics dashboard reads precomputed results.
Keep agent tool calls compatible across schema changes
An agent may pause for hours between planning a tool call and executing it. Design a tool registry that survives a breaking schema release without silently changing the requested action.
Contain prompt injection in a tool-using research agent
A research agent reads public pages and can save notes to an internal workspace. A retrieved page tells it to upload private files. Design the boundary that prevents this instruction from becoming an authorized action.
Stop an agent that repeats actions without making progress
An agent alternates between searching and reopening the same documents. Design termination controls that bound cost while still allowing useful retries.
Handle tool results that exceed an agent context budget
A database tool returns a million rows when the agent expected a short answer. Design a result protocol that bounds memory and model context without pretending a partial result is complete.
Compute useful facet counts without leaking hidden results
A product search offers brand, size and color filters. Design facet counts that show useful alternatives while respecting visibility rules and remaining consistent with the result list.
Design an adaptive jitter buffer for live speech
Voice packets arrive out of order with variable delay. Design a receiver that smooths playback without adding excessive conversational latency.
Stop streaming speech cleanly when the user interrupts
A voice assistant generates text and speech ahead of playback. Design barge-in so an interruption stops old audio and prevents late chunks from leaking into the next response.
Allocate video layers for a constrained conference receiver
A video conference receiver has limited downlink bandwidth while several speakers publish multiple video layers. Design SFU forwarding that preserves audio and adapts without constant quality oscillation.
Split a hot key range without creating two write owners
A range-partitioned store has one overloaded partition while other servers are idle. Design an online split that preserves acknowledged writes and routes stale clients safely.
Route reads with an explicit maximum staleness bound
A reporting API may return data at most five seconds old. Design replica routing that enforces this promise during replication lag and primary failover.
Detect silent storage corruption with a scrub scheduler
A replicated object store rarely reads cold objects. Design periodic integrity scrubbing that detects corruption without overwhelming foreground traffic or repairing from an untrusted copy.
Protect a hot cache from one-time scans
A dashboard cache works well until a nightly scan reads thousands of unique keys and evicts the hot working set. Design admission control that distinguishes a miss from a reason to retain an item.
Rename a directory atomically in a distributed namespace
A distributed file service must move a directory to a new parent while clients are creating children and reading paths. Design atomic namespace semantics without copying every file.
Two ways to read.
Connect it to ML serving.
Freshness and fallbacks in search
Apply the same reasoning about deadlines, state, and degraded behavior to an ML system.