Design a Durable Workflow Engine for Long-Running Trip Processes
Last updated: November 29, 2026
Quick Overview
Design a platform like Uber's Cadence that lets engineers write long-running business processes (driver onboarding, refund handling, trip settlement) as ordinary code that survives crashes, retries steps, and can wait for days.
Uber
November 29, 20260
0
0 solved
Design a platform like Uber's Cadence that lets engineers write long-running business processes (driver onboarding, refund handling, trip settlement) as ordinary code that survives crashes, retries steps, and can wait for days.
Uber open-sourced Cadence because hundreds of services were hand-building state machines on top of queues and cron. Interviewers ask this to see if you understand event-sourced workflow state, deterministic replay, task queues, and durable timers at the platform level.
What the Interviewer Expects
- Persist workflow state as an append-only event history
- Explain deterministic replay to rebuild in-memory state
- Separate workflow decisions from side-effecting activities
- Provide durable timers, retries, and timeouts
- Partition workflows by id with shard ownership
- Discuss versioning running workflows when code changes
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- Why must workflow code be deterministic, and what breaks if it calls the current time directly?
- How do you deploy a code change while 2 million workflows are mid-flight?
- How does a workflow wait for an external signal like a document approval?
- What limits history size and how do you handle a workflow that runs for a year?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Developers write onboard_driver() as code: run background check, wait up to 14 days for document upload, retry a payment setup call, send emails. The platform must guarantee each workflow continues ...
High-Level Design
- Frontend API: start workflow, signal, query, cancel.
- History service: owns workflow executions, partitioned into shards by hash of workflow id. Each shard is owned by one host at a time (m...