← DoorDash Interview Insights

DoorDash·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Jul 2026

Summary

DoorDash system design round for a software engineer role, basically one big question about building a donation ingestion service with rolling time windows. Pretty dense problem space, lots of moving parts to juggle at once.

Questions Asked (5)

Q1

Design a donation ingestion service that supports rolling 3-day totals per campaign and a top-K leaderboard, with high write throughput and low-latency reads.

System DesignTechnical Trade-offs
Author's notes

This is a lot to hold in your head at once.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., write throughput, read latency, consistency, campaign scale) and then propose a high-level architecture that separates the write path (ingestion) from the read path (querying). Use a stream processing layer to compute rolling 3-day totals and maintain a leaderboard, leveraging appropriate data stores for each access pattern.

Pro tip: Emphasize trade-offs: for example, using approximate algorithms (like Count-Min Sketch) for top-K can reduce memory and increase speed, but may sacrifice exactness; discuss when that's acceptable. Also, mention the importance of idempotency and exactly-once processing to avoid double-counting donations.

1. Clarify Requirements and Scale

Ask questions to understand expected write QPS, read QPS, latency SLAs, campaign count, donation size, and consistency needs. This will drive design choices.

2. Design Write Path for High Throughput

Propose an ingestion pipeline: API gateway -> message queue (e.g., Kafka) -> stream processor (e.g., Flink) for real-time aggregation. Ensure idempotency and durability.

3. Compute Rolling 3-Day Totals

Use windowed aggregations in the stream processor to maintain per-campaign totals over a sliding 3-day window. Store results in a fast read store (e.g., Redis or Cassandra).

4. Maintain Top-K Leaderboard

For low-latency reads, maintain a sorted set in Redis or use a stream processor to update a leaderboard. Consider approximate algorithms for scalability.

5. Address Trade-offs and Failure Handling

Discuss consistency vs. availability, exactly-once vs. at-least-once, and how to handle late data, reprocessing, and scaling. Mention monitoring and alerting.

Key Points to Mention

  • Use of stream processing (e.g., Kafka + Flink) for real-time aggregation and windowing.
  • Idempotency and deduplication to handle retries and ensure accurate totals.
  • Choice of data stores: write-optimized (e.g., Kafka) vs. read-optimized (e.g., Redis) and their trade-offs.
  • Sliding window implementation details: tumbling vs. sliding windows, watermarks for late data.
  • Top-K algorithms: exact (e.g., sorted set) vs. approximate (e.g., Count-Min Sketch) and their trade-offs.
  • Scalability and partitioning strategies: sharding by campaign ID, horizontal scaling of stream processors.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How would you handle duplicate donation submissions to ensure idempotency at high throughput?

System DesignTechnical Trade-offs
Author's notes

Went with a dedup layer keyed on donation_id before anything hits the aggregation pipeline.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: what defines a duplicate (same user, amount, timestamp?), the expected throughput, and the acceptable latency. Then propose a multi-layered idempotency strategy using client-generated idempotency keys, a fast distributed store like Redis with atomic operations, and a durable database with unique constraints. Discuss trade-offs between consistency, latency, and cost, and how to handle edge cases like retries and partial failures.

Pro tip: Emphasize that idempotency should be enforced at the API gateway or service entry point to reject duplicates early, and mention that idempotency keys should have a TTL to avoid unbounded storage growth. Also, highlight the importance of monitoring duplicate rates to detect abuse or bugs.

1. Clarify requirements and constraints

Ask about the definition of a duplicate, expected throughput (e.g., thousands per second), latency requirements, and whether the system is distributed. This shows you understand the problem context before diving into solutions.

2. Design idempotency key mechanism

Propose that clients generate a unique idempotency key (e.g., UUID) per donation attempt and include it in the request. The server uses this key to detect and ignore duplicates.

3. Implement fast duplicate detection

Use a distributed cache like Redis with atomic SETNX or similar to check and store the key quickly. This handles high throughput and provides low-latency duplicate rejection.

4. Ensure durability and consistency

Persist the idempotency key and donation record in a database with a unique constraint on the key. Use transactions or two-phase commit to avoid race conditions and ensure that if the cache fails, the database still enforces idempotency.

5. Handle edge cases and trade-offs

Discuss TTL for keys, handling retries with exponential backoff, and what happens if the cache is unavailable (fallback to database). Also, consider the trade-off between strong consistency and availability, and how to scale the solution.

Key Points to Mention

  • Idempotency keys: client-generated unique identifiers per request
  • Distributed cache (e.g., Redis) with atomic operations for fast duplicate detection
  • Database unique constraints and transactions for durability
  • TTL for idempotency keys to manage storage and allow re-submission after a period
  • Handling race conditions and partial failures (e.g., using two-phase commit or saga patterns)
  • Monitoring and alerting on duplicate rates to detect issues

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Donations can arrive late or out of order due to mobile clients being offline. How does your design handle event-time windowing correctly in this scenario?

System DesignData Modeling
Author's notes

This is where I felt most shaky.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: event-time processing with out-of-order and late data, and the need for correct windowing. Then describe a design that uses event timestamps, watermarks, and allowed lateness, with a mechanism to handle late arrivals (e.g., side outputs or updates). Finally, discuss trade-offs and how you would validate correctness.

Pro tip: Emphasize that you separate event time from processing time and use watermarks to bound the wait for late data. Mention that you would monitor late-data rates and adjust allowed lateness dynamically to balance correctness and latency.

1. Clarify requirements and constraints

Ask about the expected lateness, volume, and whether exactly-once semantics are needed. Confirm that the goal is correct event-time windowing despite out-of-order and late donations.

2. Choose an event-time processing model

Explain that you will use event timestamps from the donation source and a stream processing framework that supports event-time windowing (e.g., Flink, Beam, Kafka Streams).

3. Define windowing and watermark strategy

Describe the window type (e.g., tumbling or sliding) and how watermarks are generated (e.g., based on max observed event time minus a delay). Discuss how watermarks trigger window computation.

4. Handle late and out-of-order events

Explain allowed lateness: windows remain open for a configurable period after watermark passes. Late events within allowed lateness update the window result; events beyond that go to a side output for separate handling or alerting.

5. Ensure correctness and idempotency

Use unique donation IDs and deduplication to avoid double-counting. If updates are emitted, ensure downstream systems can handle retractions or upserts (e.g., via a database with primary keys).

Key Points to Mention

  • Event time vs. processing time: use event timestamps from the donation record, not arrival time.
  • Watermarks: generate watermarks to track progress and trigger window computations, with a delay to accommodate out-of-order events.
  • Allowed lateness: configure a grace period during which late events can still update window results.
  • Side outputs: route events that arrive after allowed lateness to a separate stream for monitoring or manual correction.
  • Idempotency and deduplication: use unique donation IDs to prevent double-counting when events are reprocessed or updated.
  • Trade-offs: discuss latency vs. completeness, and how to tune allowed lateness based on business needs.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Walk through your data model and storage choices for both the raw event log and the pre-aggregated totals.

Data ModelingSystem Design
Author's notes

Two separate concerns and I tried to keep them separate in my answer.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the scale and access patterns (write-heavy raw events vs. read-heavy aggregates), then propose a dual-store architecture: an append-only raw event log for durability and replay, and a pre-aggregated store optimized for low-latency reads. Justify each choice with trade-offs around cost, consistency, and query performance, and tie it back to DoorDash's real-time analytics needs.

Pro tip: Explicitly discuss how you'd handle late-arriving events and backfills in the pre-aggregated store—this shows you understand real-world data pipelines, not just theoretical models. Also, mention that you'd start with a simple design and evolve it as scale demands, demonstrating pragmatism.

1. Clarify requirements and access patterns

Ask about data volume, write throughput, read latency, query types, and retention needs. Establish that raw events are immutable and append-only, while aggregates are updated frequently and read with low latency.

2. Design the raw event log

Propose a partitioned, append-only store like Apache Kafka for ingestion and Amazon S3 (or HDFS) for long-term storage, using a columnar format (Parquet) for efficient scans. Emphasize durability, replayability, and schema evolution.

3. Design the pre-aggregated totals store

Choose a low-latency database like Apache Druid, ClickHouse, or Cassandra that supports fast aggregations and upserts. Model the data as denormalized tables keyed by dimensions (e.g., time, region, restaurant) with pre-computed metrics.

4. Explain the data flow and consistency

Describe how events flow from the log to the aggregates via stream processing (e.g., Flink, Spark Streaming), including windowing, late-event handling, and idempotent updates. Discuss trade-offs between exactly-once and at-least-once semantics.

5. Address scalability, cost, and evolution

Discuss partitioning, indexing, and tiered storage to manage cost and performance. Mention how you'd handle schema changes, backfills, and scaling reads/writes independently.

Key Points to Mention

  • Partitioning and indexing strategies for both stores (e.g., time-based partitioning, sort keys).
  • Choice of storage formats (e.g., Parquet for raw, columnar for aggregates) and their impact on query performance.
  • Stream processing frameworks (Flink, Spark Streaming) for transforming raw events into aggregates.
  • Handling late-arriving data and ensuring idempotency in aggregate updates.
  • Trade-offs between consistency models (e.g., eventual vs. strong) and their implications for analytics.
  • Cost optimization through tiered storage (hot vs. cold) and compression.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

How would you serve the top-K leaderboard at low latency given the rolling window updates continuously?

System DesignAlgorithms & Data Structures
Author's notes

My instinct was a sorted set in Redis, updated as donations come in and expired as the window slides.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: define 'top-K' (e.g., K=100), the rolling window (e.g., last 5 minutes), and update frequency. Then propose a hybrid architecture: a fast in-memory data structure (e.g., sorted set or heap) for real-time updates, combined with periodic snapshots and incremental updates to serve queries with low latency. Discuss trade-offs between exact and approximate solutions, and how to handle high throughput and scale.

Pro tip: Emphasize that the rolling window means you need to evict old data; using a time-bucketed approach (e.g., per-second buckets) simplifies eviction and allows efficient merging for queries. Also, mention that you'd start with a simple solution and iterate based on actual latency and throughput metrics.

1. Clarify Requirements

Ask about the expected scale (QPS, number of users, K value), latency target (e.g., <10ms), window size (e.g., 1 minute, 1 hour), and update rate. Confirm whether approximate results are acceptable.

2. Choose Data Structures

Propose using a combination of a hash map for counts and a sorted set (e.g., Redis ZSET) or a min-heap of size K for maintaining top-K. For rolling windows, consider time-bucketed counters (e.g., per-second buckets) to handle eviction efficiently.

3. Design Update and Query Paths

On each event, update the relevant time bucket and adjust the top-K structure incrementally. For queries, merge buckets within the window and compute top-K, possibly using a heap-based merge. Discuss caching frequent queries.

4. Address Scalability and Consistency

Shard by user or leaderboard ID to distribute load. Use replication for read scalability. Discuss consistency trade-offs: eventual consistency may be acceptable for leaderboards. Consider using a streaming platform (e.g., Kafka) for event ingestion.

5. Optimize and Evaluate Trade-offs

Compare exact vs. approximate algorithms (e.g., Count-Min Sketch for heavy hitters). Discuss memory vs. latency trade-offs. Propose monitoring and iterative improvements based on metrics.

Key Points to Mention

  • Time-bucketed counters for efficient rolling window eviction
  • Use of sorted sets (e.g., Redis ZSET) or heaps for top-K maintenance
  • Incremental updates vs. recomputation on query
  • Sharding and replication for scalability
  • Approximate algorithms (e.g., Count-Min Sketch, Space-Saving) for high-cardinality scenarios
  • Caching and precomputation for hot leaderboards

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.