DoorDash Software Engineer Interview Prep Guide
Everything DoorDash actually asks Software Engineer candidates — concept walkthroughs, worked examples, and the real interview questions, drawn from candidate reports. Free to read.
Last updated

You marked API design and OOD-related concepts as shaky, so the plan emphasizes REST resources, versioning, rate limiting, idempotent payment/API flows, and service-code design patterns. You did not show high solved volume in any area, so coding, debugging, and behavioral stay at normal review rather than being collapsed to brief. The DoorDash-specific highlights are payment/refund/payout workflows, event-stream courier pay, notifications under provider failure, and feed pagination patterns. With less than a week, the budget is roughly 2.3 hours across these cheatsheet sections, with most time shifted to system design/API fundamentals.
Technical Screen — 66 min
Coding & Algorithms
-
Consistent Hashing For Distributed Caches — covered in depth under Onsite below.
-
Event Stream And Interval Pay Computation — covered in depth under Onsite below.
System Design
-
Payment, Donation, Refund, And Payout Workflows (Focus) — covered in depth under Onsite below.
-
Resource-Oriented REST Design (Focus) — covered in depth under Onsite below.
-
API Versioning And Backward Compatibility (Focus) — covered in depth under Onsite below.
-
Rate Limiting And Throttling (Focus) — covered in depth under Onsite below.
Software Engineering Fundamentals
-
API Aggregation And Partial Failure (Focus) — covered in depth under Onsite below.
-
Object-Oriented Design For Service Code (Focus) — covered in depth under Onsite below.
Onsite — 72 min
Coding & Algorithms
Core DoorDash-adjacent routing topic; your coding rating is 3/5 with minimal platform practice, so keep it at normal review.
What's being tested
These problems test implementing and reasoning about consistent hashing with a sorted ring, virtual nodes, collision handling, and wraparound lookup. You must compare it against round-robin, preserve key-to-node ownership when membership changes, and analyze time, space, concurrency, and correctness. Expect debugging around hash/equality contracts, mutable state, and concurrent access.
Patterns & templates
-
Consistent-hash ring: map physical or virtual node tokens to hashes; select the first token
>= keyHash, wrapping to the minimum token. -
Use a sorted map such as
`TreeMap`/`SortedMap`; lookup isO(log V), insertion/removalO(log V), and storageO(V)virtual nodes. -
Add
Kvirtual replicas per server to reduce skew; total ring positions areV = N × K, with largerKimproving balance but increasing memory and rebuild cost. -
Define deterministic hashing and collision behavior; if equal tokens occur, use a composite
(hash, nodeId)key or collision bucket rather than overwriting. -
For
round-robin, maintain an atomic counter and choosenodes[counter % nodeCount]; handle empty membership and concurrent updates explicitly. -
Preserve the hash-map invariant: equal keys must produce equal hashes; resizing must reinsert entries, and collision resolution must remain correct.
-
Test empty rings, one node, wraparound, duplicate nodes, node removal, hash collisions, concurrent reads/writes, and distribution using many keys.
Common pitfalls
Pitfall: Claiming only “one key moves” when adding a node; consistent hashing limits movement to the new node’s successor intervals, not exactly one key.
Pitfall: Forgetting wraparound, so keys larger than the greatest token fail instead of mapping to the smallest token.
Pitfall: Using physical nodes only and concluding distribution is always balanced; sparse tokens can create large ownership gaps and severe load skew.
Practice these
The practice cards below cover the canonical variants — solve all of them and time yourself.
Practice questions
Very DoorDash-specific pay-log problem, but you did not mark interval/event coding as shaky; practice one representative implementation.
What's being tested
These problems test event-stream interval aggregation: converting unordered start/stop events into active time segments, then applying rates, overlaps, and conditional multipliers correctly. You must demonstrate careful input validation, deterministic handling of malformed or duplicate events, exact monetary arithmetic, and clear O(n log n) algorithmic reasoning.
Patterns & templates
-
Sweep line — convert starts to
+1and ends to-1, sort timestamps, then charge each interval using the active count before applying the delta. -
Interval aggregation — for consecutive timestamps
t[i-1],t[i], contribution is(t[i] - t[i-1]) × active_orders × rate; skip zero-length segments. -
Event pairing — maintain
open_order_id → start_time; reject unmatched ends, duplicate starts, negative durations, and invalid event types explicitly. -
Conditional rates — split intervals at every peak-window boundary, then apply the correct multiplier per segment rather than classifying only by start time.
-
Money arithmetic — represent cents as integers, such as
30cents per minute; round only once at the final boundary using the stated rule. -
Daily boundaries — intersect each delivery interval with
[day_start, day_end); use half-open intervals to avoid double-counting midnight or adjacent segments. -
Complexity target — sorting dominates at
O(n log n)time andO(n)space; a hash map plus sorted events is appropriate for millions of records.
Common pitfalls
Pitfall: Charging each order independently can miscompute concurrent-rate rules; aggregate active count across sorted timestamps instead.
Pitfall: Using floating-point dollars introduces rounding errors; parse timestamps consistently and compute in integer cents or exact decimals.
Pitfall: Silently “fixing” malformed or duplicate events creates non-deterministic pay; define whether to reject, ignore, or deduplicate and explain why.
Practice these
The practice cards below cover the canonical variants—solve all of them and time yourself.
Practice questions
System Design
Focus area — Your idempotency-key rating is shaky, and DoorDash money workflows depend on retries, webhooks, reconciliation, and duplicate-charge prevention.

What's being tested
These problems test whether you can design reliable distributed workflows around money, where requests may be retried, providers may respond asynchronously, and internal state can diverge from external payment state. You are expected to model explicit states, enforce idempotency, handle partial success and cancellation, and make progress observable rather than assuming a synchronous API call completes the business operation. DoorDash cares because duplicate charges, missing refunds, or incorrect donation totals damage customer trust and create difficult financial reconciliation work.
Core knowledge
-
A payment state machine should distinguish
CREATED,REQUIRES_ACTION,PROCESSING,SUCCEEDED,FAILED,CANCELED, andREFUNDED; define legal transitions explicitly and reject stale or contradictory updates. -
Idempotency prevents retries from creating duplicate charges or refunds. Store
(merchant, idempotency_key) -> request_hash, operation_id, final_or_pending_resultdurably, and return the original result for an identical retry. -
Treat provider calls as at-least-once effects: a timeout does not prove failure. Persist the operation before calling the provider, reuse the same provider idempotency key, and reconcile ambiguous outcomes through status lookup or a settlement feed.
-
Separate accepted, completed, and failed responses. A
202 Acceptedmeans durable work was recorded, not that money moved; return an operation ID and expose polling, callbacks, or a status stream. -
A refund workflow is naturally an outcome-driven DAG: nodes perform actions, and edges route on outcomes such as
SUCCEEDED,RETRYABLE_FAILURE,PERMANENT_FAILURE, orCANCELED. Persist node state so workers can resume after crashes. -
For partial refunds, enforce an invariant such as . Use database transactions or conditional updates to prevent concurrent refund requests from exceeding the captured amount.
-
The transactional outbox pattern commits business state and an event in one database transaction; an asynchronous publisher later delivers the event. Consumers still need idempotent processing because delivery is generally at least once.
-
Use optimistic concurrency control with a version column or compare-and-swap transition:
UPDATE ... WHERE state = expected_state AND version = v. This prevents late callbacks and concurrent workers from overwriting newer decisions. -
Reconciliation compares internal records with provider truth and settlement records. It should identify missing callbacks, unknown provider operations, amount mismatches, and stuck
PROCESSINGpayments, then retry safely or route to manual review. -
Rolling donation totals require a canonical donation event and a deduplicated aggregation path. For a three-day event-time window, conceptually compute while handling duplicate events, late arrivals, and corrections.
-
Consistency boundaries should be explicit: payment authorization and refund limits need strong transactional consistency; leaderboards and displayed donation totals can usually be eventually consistent, provided they show a timestamp or freshness indicator.
-
Design for traffic spikes with stateless API workers, durable queues, bounded worker concurrency, exponential backoff with jitter, and provider rate-limit handling. Queue depth, oldest-message age, provider error rate, and stuck-operation count are useful operational signals.
-
Keep payment data minimized and protected: use provider tokens instead of raw card data, encrypt sensitive fields, authorize operations by merchant and payment ownership, and maintain an immutable audit log containing actor, amount, request ID, state transition, and timestamp.
Worked example
For Build a Refund Workflow Engine over an Outcome-Driven DAG, a strong candidate first clarifies whether refunds must support partial amounts, whether external payment providers are synchronous, what cancellation guarantees are required, and whether workflows can be edited after execution begins. They should declare that the system provides durable acceptance, at-least-once execution, idempotent external effects, and eventual completion rather than pretending to offer exactly-once distributed execution. The answer can be organized around four pillars: a persisted DAG and workflow state machine, a scheduler and durable work queue, duplicate-safe action workers, and observability plus reconciliation. Each node should record attempts, input, output, provider operation ID, retry policy, and terminal outcome, while conditional edges select the next node. A key tradeoff is whether to store arbitrary DAG definitions for flexibility or restrict workflows to validated templates that are easier to reason about and secure. The candidate should explicitly explain that a timeout after submitting a refund remains UNKNOWN or PROCESSING until a provider lookup resolves it, rather than immediately retrying with a new operation. They should close with: “If I had more time, I’d detail workflow versioning, authorization for cancellation, dead-letter handling, and recovery from a database or queue outage.”
A second angle
For Design a 3-day donation platform, the primary framing shifts from long-running workflow orchestration to high-volume ingestion, payment correctness, and low-latency aggregate reads. The core design still uses payment intents, idempotency keys, durable state transitions, verified provider callbacks, and reconciliation for ambiguous outcomes. The three-day total and leaderboard can be served from an asynchronously maintained aggregate, while the payment ledger remains the source of truth. The important tradeoff is freshness versus write-path complexity: synchronous aggregation gives fresher results but couples donation latency to aggregate storage, whereas asynchronous aggregation scales better and tolerates brief display lag. Clarify whether the total is based on authorized, captured, or settled donations, because that decision changes both state transitions and window membership.
Common pitfalls
Pitfall: Treating a provider timeout as a failed payment and blindly retrying can double-charge a customer. A stronger answer models
UNKNOWNorPROCESSING, reuses the provider idempotency key, and resolves the result through lookup or reconciliation.
Pitfall: Jumping directly into
Kafka, sharding, and worker pools without stating guarantees leaves the interviewer unsure what the system promises. Start with scope, consistency requirements, success criteria, and failure assumptions, then map each component to one guarantee.
Pitfall: Saying “make it idempotent” without identifying the key, storage location, request-hash behavior, retention policy, and concurrent-request handling is incomplete. Explain how the database constraint and provider-side idempotency cooperate when the process crashes between recording and calling the provider.
Connections
An interviewer may pivot to sagas, transactional outbox and inbox patterns, event sourcing, or dead-letter queue recovery. They may also probe database isolation levels, webhook signature verification, rate limiting, or multi-region failover.
Further reading
-
Designing Data-Intensive Applications — Martin Kleppmann’s treatment of consistency, streams, transactions, and reliable event processing.
-
Stripe API: Idempotent Requests — a concrete production model for safe retries around payment operations.
-
Temporal Documentation: Workflows — useful for understanding durable asynchronous workflow execution and recovery semantics.
Practice questions
Resource-Oriented REST Design
Focus areaFocus area — You marked resource-oriented REST shaky and selected API design; use DoorDash order, cart, payout, and review resources as examples.

What's being tested
The interviewer is testing whether you can model an API around durable resources and their relationships rather than exposing database tables or RPC-shaped actions. You should demonstrate sound choices for URLs, HTTP methods, status codes, representations, validation, pagination, concurrency, and error behavior. DoorDash operates APIs spanning consumers, merchants, dashers, orders, payments, and delivery workflows, so correctness under retries, concurrent updates, partial failure, and evolving clients matters as much as a clean endpoint list.
Core knowledge
-
Resource modeling identifies nouns with independent identity and lifecycle:
/orders/{orderId},/orders/{orderId}/items, and/couriers/{courierId}/location. Avoid verbs such as/createOrderunless the operation is genuinely an action that cannot be represented as resource creation. -
HTTP method semantics should be explicit:
GETretrieves,POSTcreates or triggers a non-idempotent operation,PUTreplaces a known resource,PATCHapplies a partial update, andDELETEremoves or deactivates one. Do not usePOSTfor every mutation. -
Idempotency means repeating a request produces the same intended effect.
GET,PUT, andDELETEare conventionally idempotent;POSTusually is not. For order placement or payment, accept anIdempotency-Key, persist the key with the result, and return the original response on retry. -
HTTP status codes communicate machine-readable outcomes:
201 Createdwith aLocationheader for creation,200 OKfor a returned representation,204 No Contentfor successful empty responses,400for malformed input,404for absent resources,409for state conflicts,412for failed preconditions, and429for throttling. -
Representation design should separate the public contract from internal persistence. Return stable identifiers, explicit timestamps such as
created_atandupdated_at, enum values with documented evolution rules, and links or nested objects only when they serve the client’s use case. -
Validation has multiple layers: syntactic validation checks types and formats; semantic validation checks business rules; authorization checks whether the caller may perform the operation. For example, a valid UUID does not imply that the caller may modify that order.
-
Pagination should be cursor-based for large or changing collections: return items plus a
next_cursor, where the cursor encodes a stable ordering such as(created_at, id). Offset pagination is simpler but can skip or duplicate records as rows are inserted or deleted. -
Filtering and sorting need bounded, documented behavior. Prefer allowlisted fields such as
statusandcreated_after; reject arbitrary SQL-like expressions. Stable sorting requires a tie-breaker, for exampleORDER BY created_at DESC, id DESC, to make pagination reliable. -
Optimistic concurrency control prevents lost updates. Return an
ETagor version, requireIf-Matchon updates, and respond with412 Precondition Failedwhen the resource changed. A last-write-wins update is simpler but can silently overwrite another actor’s change. -
State transitions should enforce a server-side state machine. An order might move from
createdtoconfirmed,preparing,picked_up, anddelivered; reject invalid transitions with409 Conflictrather than allowing clients to mutate a status field arbitrarily. -
Authentication and authorization are separate concerns. A bearer token may identify the caller, while resource-level authorization determines whether that consumer, merchant, courier, or internal service can access a specific order. Prevent insecure direct object references by checking ownership or policy on every request.
-
Compatibility and observability are part of the API contract. Prefer additive changes, tolerate unknown response fields, deprecate rather than abruptly remove fields, and emit request IDs, structured logs, latency metrics such as
`p99`, and audit events for sensitive mutations.
Worked example
No concrete interview title was supplied, so use this representative prompt: “Design a REST API for creating and tracking a DoorDash order.” In the first 30 seconds, clarify whether the API serves consumers or internal clients, whether payment is synchronous, which order states must be exposed, expected read/write volume, and whether clients retry requests. Organize the answer around resource modeling, lifecycle/state transitions, consistency and idempotency, authorization, and read scalability. Model POST /orders as creation with an idempotency key, GET /orders/{id} for retrieval, and perhaps POST /orders/{id}/cancellation if cancellation is an explicit domain command rather than a generic field update. Explain that order creation should persist the request key and final result atomically enough that a timeout followed by a retry cannot create two orders. Use 409 Conflict for an invalid cancellation after preparation has started, and use ETag or a version field if multiple actors can update the order. Explicitly flag the tradeoff between returning a fully expanded order representation and returning a smaller resource with separately fetched restaurant, courier, or tracking data. Close by saying that, with more time, you would define the error schema, authorization policy, event publication behavior, and recovery path when payment succeeds but order creation does not.
A second angle
A related prompt might ask you to design a REST API for a merchant managing menu items and availability. The resource hierarchy may be /merchants/{merchantId}/menu-items, but availability could be modeled as a subresource or a separate schedule resource depending on whether it has its own lifecycle. The key difference is that bulk updates, conditional writes, and scheduled future changes may matter more than a single order’s state machine. You should discuss PATCH semantics, validation of prices and modifiers, authorization by merchant location, and concurrency when a merchant dashboard and an automated inventory service update the same item.
Common pitfalls
Pitfall: Treating REST as “URLs plus JSON” and ignoring semantics. Saying every operation should be
POST /doSomethingmisses idempotency, caching, status codes, conditional requests, and the resource lifecycle; explain why each operation maps to a method or explicit domain action.
Pitfall: Designing directly from database tables. Exposing
/orders_tableor returning internal columns couples clients to storage and makes future migrations painful; present a stable domain representation with deliberate relationships, field names, and compatibility rules.
Pitfall: Claiming retries are handled because the server is “stateless.” Network timeouts occur after the server may have committed work, so a robust answer names idempotency keys, durable deduplication state, replayed responses, and the retention window for those keys.
Connections
Expect pivots to event-driven architecture, distributed transactions, rate limiting, API versioning, and authorization policy. Resource mutations may also lead to questions about an outbox pattern, cache invalidation, webhooks, and eventual consistency between order, payment, and delivery services.
Further reading
-
RFC 9110: HTTP Semantics — authoritative definitions for methods, status codes, caching, and conditional requests.
-
RFC 5789: PATCH Method for HTTP — explains partial modification semantics and idempotency considerations.
-
Designing Data-Intensive Applications by Martin Kleppmann — useful depth on consistency, retries, event-driven systems, and distributed failure modes.
Practice questions
Focus area — You marked versioning shaky; practice backward-compatible schema changes, deprecation, mobile-client lag, and rollout safety.

What's being tested
The interviewer is testing whether you can evolve a production API without breaking deployed clients, services, or stored data. You should demonstrate a concrete compatibility strategy: contract discovery, additive schema changes, version selection, deprecation, observability, and safe rollout. DoorDash operates many independently deployed services and clients, so the key concern is managing change across deployment boundaries rather than merely choosing a URL format.
Core knowledge
-
Backward compatibility means old clients continue to work against the new server; forward compatibility means newer clients tolerate responses from an older server. Design explicitly for both, especially when mobile clients may remain deployed for weeks.
-
Prefer additive changes: optional request fields, new response fields, new endpoints, and new enum values handled as unknowns. Removing fields, renaming fields, tightening validation, or changing meanings are commonly breaking changes.
-
Choose a versioning mechanism deliberately: URI versions such as
/v2/orders, header-based versions such asAccept: application/vnd.company.order+json;version=2, or negotiated media types. URI versions are visible and operationally simple; headers preserve resource identity but are easier to misconfigure and debug. -
Treat the API description as a contract. Use
OpenAPIorprotobufdefinitions, generated clients, schema-diff checks, and compatibility gates in CI. A change should fail review if it removes a required field, changes a type, narrows accepted values, or alters documented semantics. -
For JSON, clients should ignore unknown response fields, servers should tolerate omitted optional request fields, and enum parsing should include an
UNKNOWNbranch. Do not silently reinterpret an existing value; add a new value or version the behavior. -
For
protobufand gRPC, never reuse field numbers, avoid changing a field’s wire type, reserve deleted field numbers, and use presence-aware fields where “unset” differs from a default value. Compatibility is a wire-format property, not just a source-code property. -
Separate API versioning from business behavior flags. A version describes a stable contract; a feature flag or capability negotiation selects behavior for a subset of callers. Combining them creates hard-to-reason-about states and makes rollback less reliable.
-
Use capability negotiation when clients evolve independently. A client can advertise supported features or API capabilities, allowing the server to return a compatible representation. This is often better than proliferating versions for every small optional feature.
-
Define a deprecation lifecycle: announce a replacement, measure traffic by client/version, publish a sunset date, notify owners, and remove only after usage reaches an agreed threshold. Include a
DeprecationorSunsetresponse header where supported, but do not rely on headers alone. -
Make rollout reversible. Deploy server support before client adoption, dual-read or dual-write during storage migrations, canary by caller or percentage, and retain the old path until dashboards show error rate, latency, and semantic correctness are stable.
-
Compatibility includes operational behavior, not only schemas. A new endpoint that changes authorization, idempotency, pagination ordering, error codes, rate limits, or latency can break clients even when its JSON shape appears compatible.
-
Test at multiple boundaries: consumer-driven contract tests, golden request/response fixtures, fuzzing for unknown fields, backward/forward schema checks, and integration tests against old and new client versions. Test retries, duplicate requests, partial failures, and malformed input explicitly.
Worked example
Prompt: Design a backward-compatible evolution strategy for an orders API. In the first 30 seconds, clarify whether callers include mobile clients, internal services, and third parties; whether old clients must work indefinitely; which fields and semantics may change; and the latency, authentication, and rollback requirements. I would organize the answer around four pillars: contract and compatibility rules, version selection, rollout and migration, and observability/deprecation. I would start with additive changes such as an optional delivery_instructions field and a new endpoint for functionality that cannot preserve the old contract. For a breaking change, I would use an explicit version such as /v2/orders, maintain both implementations behind a shared domain layer, and route by authenticated client capability rather than blindly duplicating business logic. A key tradeoff is URI versioning versus header negotiation: URI versioning improves cacheability, logs, and manual debugging, while header negotiation avoids changing resource URLs but increases tooling and routing complexity. I would require schema compatibility checks in CI, consumer contract tests, version-specific dashboards, and a canary before broad adoption. I would close by saying that, with more time, I would inspect real client-version traffic, define the sunset policy with owners, and test authorization, pagination, retries, and error semantics—not just the response schema.
A second angle
Prompt: Migrate a protobuf/gRPC service while older binaries remain deployed. The framing changes from public URL design to wire compatibility, field numbering, and mixed-version behavior during rolling deployment. I would reserve removed field numbers, add new fields rather than repurpose old ones, ensure old readers ignore new fields, and make new readers tolerate absent fields. The main risk is semantic rather than syntactic: a new server may send a value that an old client cannot interpret correctly, so capability checks or an explicitly versioned RPC may be safer than relying on unknown-field handling. I would validate the migration with old-client/new-server and new-client/old-server integration tests.
Common pitfalls
Treating “additive” as automatically safe. Adding a response field is usually compatible, but adding a required request field, changing pagination order, introducing a new enum value, or increasing response size can still break clients. Explain the client parsing and behavioral assumptions, not just the schema diff.
Pitfall: Saying “we will release
/v2” without explaining how clients discover it, how traffic migrates, how both versions are tested, or when/v1is removed.
Ignoring deployed-client reality. A backend engineer may propose updating every caller atomically, but mobile apps, partner integrations, and independently deployed services rarely permit that. State the deployment order, coexistence period, owner notification process, and rollback path.
Pitfall: Focusing deeply on version syntax while missing authentication, authorization, idempotency, rate limits, error codes, observability, and semantic changes—all of which can create production incompatibility.
Connections
The interviewer may pivot to consumer-driven contract testing, schema evolution in protobuf or event systems, database expand-and-contract migrations, and distributed rollout or feature-flag design. They may also ask how retries and idempotency behave when old and new clients coexist.
Further reading
-
Microsoft REST API Guidelines — Practical guidance on compatibility, versioning, errors, pagination, and evolution.
-
Google API Design Guide — Detailed conventions for resource-oriented APIs, compatibility, and version management.
-
Protobuf Language Guide: Updating a Message Type — Concrete wire-compatibility rules for adding, removing, and reserving fields.
Practice questions
Rate Limiting And Throttling
Focus areaFocus area — You marked rate limiting shaky; focus on per-user, per-merchant, and provider-protection limits with graceful 429 semantics.

What's being tested
Rate limiting and throttling questions test whether you can design a correct distributed admission-control mechanism under concurrency, retries, bursts, and partial failures. The interviewer is probing algorithm selection, state placement, atomicity, multi-instance behavior, and the distinction between rejecting, delaying, and degrading work. DoorDash services must protect checkout, delivery orchestration, authentication, and partner APIs from traffic spikes without turning transient overload into cascading failure, so the key skill is balancing client fairness, system safety, and latency.
Core knowledge
-
Rate limiting bounds request volume over time; throttling is broader and may delay, queue, shed, or reduce work. Clarify whether the requirement is “N requests per minute,” “N concurrent requests,” a byte limit, or a downstream-capacity limit.
-
The token bucket stores tokens replenished at rate , up to capacity . Each request consumes tokens; it allows bursts up to while maintaining long-term throughput near . It is usually the strongest default for APIs.
-
The leaky bucket drains at a fixed rate, smoothing output and limiting downstream pressure. It provides predictable shaping but can add queueing latency; define behavior when the queue is full: reject, drop oldest, or drop newest.
-
A fixed window counter is simple and cheap but permits boundary bursts: a client can issue nearly requests across adjacent windows. Add a distributed atomic increment and expiration, but do not present it as precise fairness.
-
A sliding-window log records timestamps and removes entries older than the interval, giving accurate enforcement at the cost of state per key. A sliding-window counter approximates this using adjacent buckets and is often a better large-scale tradeoff.
-
For multiple service instances, local in-memory state is fast but inconsistent across replicas. Shared state in
Rediscan coordinate decisions, provided token updates use an atomic Lua script or an equivalent server-side operation rather than separate read-modify-write commands. -
A limiter key should match the protection and fairness boundary:
user_id, API key, IP, restaurant, merchant, route, or a tuple such as(tenant, endpoint). Use hierarchical limits when needed: per-user, per-tenant, global, and downstream-resource limits. -
Atomicity matters at the exact decision point: calculate elapsed time, refill tokens, test availability, decrement, and set expiration as one operation. Otherwise concurrent requests can overspend tokens or reset a counter incorrectly.
-
Return
429 Too Many Requestsfor policy-based rejection and includeRetry-Afterwhen a retry time is meaningful. Distinguish this from503 Service Unavailable, which signals server or dependency incapacity; clients may apply different retry policies. -
A distributed limiter must define failure behavior. Fail-open preserves availability but risks overload; fail-closed protects dependencies but can cause broad outages. A bounded local fallback, short state TTLs, and circuit breakers often provide a safer hybrid.
-
Retries can multiply traffic: one logical request may generate several physical requests. Combine rate limits with idempotency keys, exponential backoff with jitter, request deadlines, and bounded retries so throttling does not create a retry storm.
-
Fairness and capacity are different goals. A global bucket protects total throughput, while per-client buckets prevent one noisy customer from monopolizing it. Weighted costs can charge expensive operations more than cheap reads.
Worked example
Worked example — “Design a distributed rate limiter”
In the first 30 seconds, clarify the limit dimensions, burst allowance, request cost, enforcement scope, acceptable decision latency, and whether rejection or queuing is expected. I would state an assumption such as “each user gets 100 requests per minute with bursts of 20, enforced consistently across service replicas.” I would organize the answer around the algorithm, state and key design, atomic distributed implementation, and operational behavior under failures and overload. A token bucket in front of the protected handler gives an intuitive burst policy, while a Redis Lua script can atomically refill and consume tokens using server time. The key might be (tenant_id, route_class) with TTL cleanup, plus a global bucket for a dependency whose capacity is shared across tenants. I would explicitly trade stronger global consistency against latency and availability: a centralized Redis decision is more accurate but adds a network hop and creates a dependency. On Redis timeout, I would choose a bounded local fallback or fail-closed for a dangerous write path, rather than silently allowing unlimited traffic. I would return 429 with Retry-After, expose allowed/rejected counts and decision latency, and test concurrent requests, clock behavior, failover, and boundary bursts. If I had more time, I would add weighted costs, configuration rollout safeguards, and load tests measuring p99 latency and downstream saturation.
A second angle
Worked example — “Throttle requests to a downstream dependency”
Here the important constraint is not merely fairness per user; it is protecting a dependency with a known concurrency or throughput budget. A concurrency limiter such as a semaphore may be more appropriate than a time-based bucket because ten slow calls can exhaust capacity even when request rate looks acceptable. I would combine a maximum in-flight count with a timeout and possibly a queue bounded by age, rejecting quickly when waiting would violate the caller’s deadline. The design should account for dependency-specific quotas, connection-pool limits, and circuit-breaker state. This framing emphasizes latency and resource occupancy rather than only requests per minute.
Common pitfalls
Pitfall: Saying “use a counter in
Redis” without defining atomicity, expiration, or the window algorithm leaves race conditions and boundary bursts unresolved. Name the exact state transition and make it atomic.
Pitfall: Treating every overload response as
429is analytically wrong. Explain whether the client exceeded a policy limit, the service is temporarily unavailable, or a downstream dependency is saturated; each case needs different retry semantics.
Pitfall: Focusing only on the happy-path algorithm misses production depth. A stronger answer covers clock choice, multi-region behavior, fail-open versus fail-closed policy, hot keys, observability, and how retries interact with the limiter.
Connections
An interviewer may pivot to circuit breakers, backpressure, load shedding, queue-based buffering, or idempotency. They may also ask about multi-region consistency, API gateway enforcement, or capacity planning for Redis hot keys.
Further reading
-
RFC 6585 — Additional HTTP Status Codes — Defines
429 Too Many Requestsand the intended use ofRetry-After. -
“The Token Bucket” — Cisco documentation — Provides practical background on token-bucket policing and shaping.
-
Designing Data-Intensive Applications, Chapter 9 — “Consistency and Consensus” — Useful context for distributed state, failure modes, and consistency tradeoffs.
Practice questions
Software Engineering Fundamentals
API Aggregation And Partial Failure
Focus areaFocus area — You selected API design and marked several API concepts shaky; focus on deadlines, partial failure, retries, and clear response contracts.

What's being tested
These prompts test whether you can design a fan-out/fan-in API aggregator that calls multiple downstream services, combines their responses, and remains useful when some dependencies fail. The interviewer is probing your judgment around API contracts, bounded concurrency, deadlines, retry safety, partial-response semantics, and observability—not merely whether you can issue three HTTP requests. DoorDash relies on this skill because customer-facing flows often depend on restaurant, delivery, payment, identity, and address services with different latency and availability profiles.
Core knowledge
-
Fan-out/fan-in orchestration sends independent downstream requests in parallel, then joins results before responding. Sequential calls produce approximately latency; parallel calls approach plus aggregation overhead, provided concurrency is bounded.
-
Dependency classification separates required data from optional enrichments. If consumer identity is required but payment methods and addresses are optional, a consumer failure may produce
5xx, while an address timeout can produce200with an explicit unavailable or omitted section. -
Deadline propagation gives the entire request a fixed budget and derives child timeouts from remaining time. If the end-to-end budget is 800 ms, do not give every child an independent 800 ms timeout; otherwise queued work and response assembly can exceed the caller’s deadline.
-
Bounded concurrency uses a worker pool, semaphore, or structured-concurrency limit rather than creating unbounded tasks per request. This protects the aggregator and downstreams during traffic spikes; the right limit depends on connection pools, CPU, and downstream capacity.
-
HTTP status handling distinguishes transport failures, timeouts, malformed payloads, and application statuses such as
4xxor5xx. A404may mean “no optional resource,” whereas401,403, schema-invalid200, and dependency503need deliberately different semantics. -
Retry policy applies only to transient failures and preferably idempotent operations. Use exponential backoff with jitter, for example ; cap attempts and ensure retries fit inside the remaining deadline.
-
Idempotency and duplicate work matter even for reads: retries can amplify load, and writes require an idempotency key or deduplication strategy. Avoid retrying every
5xx; distinguish connection resets and503from deterministic validation failures such as400. -
Partial-response contracts should be explicit and machine-readable. A response can include
data,degradedorwarnings, and per-section status such asavailable,unavailable, ornot_authorized; never silently return an empty list that looks like valid data. -
Circuit breakers and bulkheads prevent one unhealthy dependency from consuming all threads, sockets, or latency budget. A circuit breaker opens after an error-rate or timeout threshold, while bulkheads isolate dependency-specific pools and preserve capacity for healthy services.
-
Observability requires structured logs, distributed tracing, and metrics by dependency and outcome. Track success rate, timeout rate, retry count, breaker state, fan-out latency, aggregation latency, and
p50/p95/p99; propagate a correlation or trace ID. -
Load and failure testing should cover dependency latency, connection exhaustion, malformed JSON, partial outages, cancellation, and retry storms. Validate both the external SLO and internal resource behavior; a graceful
200is not successful if worker queues or downstream traffic grow without bound.
Worked example
For “Aggregate Consumer, Payment, and Address APIs with Partial Failure,” I would first ask which data is mandatory, what response status and schema are required for each dependency failure, the expected QPS, and the end-to-end latency SLO. I would declare that consumer data is required, payment and address are optional, calls are read-only, and the aggregator has a fixed deadline such as 500 ms. I would organize the answer around contract semantics, parallel orchestration, timeout/retry policy, and observability/resource isolation. The implementation would start the three calls concurrently, apply a per-call timeout bounded by the remaining overall deadline, validate HTTP status and payload schema, and assemble available sections. A consumer timeout or invalid response would return a dependency-aware 5xx, while payment or address failure would return a degraded response with explicit section metadata. I would explicitly choose not to retry non-idempotent operations and would limit retries to one bounded attempt for transient failures, because retries can worsen a downstream outage. I would also mention cancellation: once the required consumer call fails or the client disconnects, unnecessary optional work should be cancelled where the runtime supports it. If I had more time, I would add contract tests, fault injection, circuit-breaker thresholds, and load-test results to validate the design.
A second angle
For “Build an API aggregator with concurrency and retries,” the central framing shifts from response semantics toward controlling retry amplification and latency under failure. I would clarify whether downstream calls are idempotent, whether the caller permits stale or partial data, and how much of the deadline remains after each attempt. A strong design uses parallel calls, a shared deadline, exponential backoff with jitter, and a strict retry budget rather than independently retrying every dependency. I would discuss how a retry storm can turn a partial outage into a system-wide outage, then add circuit breakers, bulkheads, and metrics for attempts per request. The key tradeoff is higher recovery from transient network errors versus extra load and worse tail latency.
Common pitfalls
Pitfall: Treating all downstream failures identically and returning
500whenever one call fails. This loses useful optional data and ignores the business distinction between required and enrichment dependencies; define failure semantics per section.
Pitfall: Saying “call everything in parallel and retry on failure” without specifying deadlines, concurrency limits, retryable statuses, or cancellation. The interviewer wants an executable policy, including what happens when the caller has only 50 ms remaining.
Pitfall: Going deep into framework syntax while skipping the API contract and operational behavior. A code sketch is useful, but first explain response shape, dependency isolation, observability, and how the design behaves during a dependency outage.
Connections
An interviewer may pivot to circuit breakers, bulkheads, and backpressure, or ask how distributed tracing identifies the slowest dependency. They may also explore API versioning, schema validation, caching, request hedging, or graceful degradation under an SLO.
Further reading
-
Site Reliability Engineering: Handling Overload — practical treatment of overload, load shedding, and protecting dependencies.
-
The Tail at Scale — explains why high-percentile latency and coordinated fan-out matter in distributed services.
-
Amazon Builders’ Library: Timeouts, retries, and backoff with jitter — detailed guidance on retry amplification and deadline-aware resilience.
Practice questions
Object-Oriented Design For Service Code
Focus areaFocus area — You selected OOD and marked encapsulation, composition, LSP, DI, and strategy shaky; refresh with service-class design exercises.

What's being tested
Object-oriented design for service code tests whether you can turn changing business rules into cohesive, testable objects rather than one large conditional-heavy method. The interviewer is probing your ability to identify domain responsibilities, define stable interfaces, manage dependencies, and explain how the design evolves when requirements change. DoorDash services combine payments, orders, merchants, delivery logistics, and third-party integrations, so good designs must isolate failure-prone dependencies while remaining easy to extend and operate.
Core knowledge
-
Single Responsibility Principle (SRP) means a class should have one reason to change. Keep orchestration in an application service, business rules in domain objects or policies, persistence in repositories, and HTTP or RPC translation at the boundary.
-
Composition over inheritance is usually safer for service code. Inject a
PricingPolicy,PaymentGateway, orNotificationSenderinto an orchestrator instead of creating a deep hierarchy whose subclasses inherit unwanted behavior. -
Dependency inversion makes high-level business logic depend on interfaces, not concrete clients. Define
PaymentGateway.charge(...)and injectStripePaymentGatewayor a fake implementation through constructor injection for production isolation and fast unit tests. -
Cohesion and coupling are the central design tradeoff. Group data and invariants that change together; avoid a “god service” that knows database schemas, transport objects, vendor APIs, retries, and every business rule.
-
Domain entities versus value objects should be distinguished explicitly. An
Orderhas identity and lifecycle;Money,Address, andDeliveryWindoware immutable value objects compared by value and responsible for validating their own invariants. -
Ports and adapters, also called hexagonal architecture, place interfaces at the domain or application boundary. Adapters translate
Postgres,Kafka, REST, or vendor-specific models without leaking infrastructure types into core business logic. -
The Strategy pattern handles interchangeable algorithms or policies, such as peak-hour fees, distance pricing, or merchant-specific cancellation rules. A registry or factory selects a strategy; callers should not contain repeated
if provider == ...branches. -
The command-orchestrator pattern separates a use case from its collaborators. An
AcceptOrderServicecan validate state, reserve capacity, persist the transition, publish an event, and return a result without implementing every operation itself. -
Invariants and state transitions belong near the object that owns them. Model legal transitions such as
CREATED → CONFIRMED → PREPARING → READY; reject invalid transitions rather than allowing arbitrary setters to mutate status. -
Idempotency is required when service methods can be retried. Accept an idempotency key, persist the key with the resulting outcome, and return the prior result on duplicate requests; do not rely only on an in-memory flag.
-
Transactions and side effects need an explicit boundary. Commit the order-state change atomically with an outbox record, then publish asynchronously; otherwise a database success followed by an event-publish failure can leave downstream services inconsistent.
-
Error modeling should distinguish validation errors, domain conflicts, dependency failures, and unexpected defects. Use typed errors or result objects, preserve safe context for logs, and avoid exposing vendor error details directly to API clients.
Worked example: Design a pluggable delivery-fee calculator
A strong candidate would first clarify whether the fee is calculated synchronously, whether pricing must be reproducible for an order, which inputs matter, and whether a missing map or pricing provider should fail closed or use a fallback. They would state assumptions such as: the calculator returns a Money value, all monetary arithmetic uses integer minor units, and the selected policy is recorded with the order. The answer would be organized around a DeliveryFeeService orchestrator, immutable input value objects, a FeePolicy strategy interface, and adapters for distance and surge data. The service would validate inputs, select a policy based on region or merchant configuration, calculate the fee, and return a decision containing the amount and explanation metadata. The policy interface might expose calculate(FeeContext), while concrete implementations handle flat pricing, distance bands, or peak-hour surcharges. A key tradeoff is whether policy selection belongs in a factory or configuration-driven registry: a registry improves runtime extensibility, while a simple factory is easier to validate and debug. The candidate should explicitly prevent floating-point money calculations and define behavior for negative distance, unknown regions, and unavailable surge data. If more time were available, they would discuss versioning policies so an already-created order is not repriced after configuration changes.
A second angle
Consider an order-cancellation service, where the same design principles apply but state consistency and side effects dominate the framing. The core object owns legal cancellation transitions, while injected collaborators determine refund eligibility, notify the merchant, and release delivery capacity. The candidate should distinguish a cancellation rejected because the order is already delivered from a cancellation that cannot complete because the payment provider is temporarily unavailable. They should also discuss idempotency and an outbox so a retry does not issue two refunds or send duplicate cancellation events.
Common pitfalls
Analytical mistake: Treating every noun as a class produces an anemic model with dozens of getters and setters but no ownership of rules. A stronger answer assigns each invariant to the object or policy that can enforce it and keeps orchestration focused on workflow.
Pitfall: Saying “use inheritance for each pricing type” is tempting, but a deep hierarchy becomes brittle when pricing varies independently by region, merchant, time, and customer segment; strategies and composition usually scale better.
Communication mistake: Jumping directly into class diagrams without clarifying inputs, consistency requirements, or failure behavior makes the design appear disconnected from the use case. State assumptions first, then explain responsibilities and one representative call flow.
Depth mistake: Stopping at “inject an interface for testability” misses production concerns. Explain retry boundaries, idempotency, transaction scope, timeout behavior, observability, and how an external failure affects the user-visible result.
Connections
An interviewer may pivot to SOLID principles, design patterns, distributed transactions, event-driven architecture, or contract testing. Be prepared to connect object boundaries to API versioning, persistence transactions, and concurrency control without turning the answer into infrastructure-only design.
Further reading
-
Design Patterns: Elements of Reusable Object-Oriented Software — foundational catalog of Strategy, Factory, Adapter, and other patterns.
-
Domain-Driven Design — useful treatment of entities, value objects, aggregates, and bounded contexts.
-
Patterns of Enterprise Application Architecture — practical patterns for service layers, repositories, identity maps, and transaction boundaries.
Practice questions