Replay or rows: three ways to make code durable
Every durable execution engine answers one question: after a crash, how does the work know where it was?
A workflow that moves money, books a trip or runs an AI agent for an hour will, sooner or later, meet a machine that dies halfway. Durable execution engines exist so that it does not matter. They all promise the same outcome: the work continues where it stopped, and what was finished is not done twice.
How they keep that promise falls into three families. Each is carefully engineered and each has a price. Here they are side by side.
1. A declared graph
AWS Step Functions and Google Cloud Workflows describe the workflow as a graph, in JSON or YAML: states, transitions, parallel branches, maps. The service records each transition and, after a failure, continues the graph from the state it was in.
The strength is clarity: the graph is the workflow, and the service owns the bookkeeping. The price is expressiveness. Rich logic (a loop whose length depends on the data, a decision that reads three earlier answers) is awkward to write as a graph, and it lives outside the code your team writes and tests every day.
2. Code, made durable by journal and replay
Temporal, Restate, Azure Durable Functions and AWS Lambda durable functions let you write the workflow as ordinary code, calling the engine's SDK for each step. The engine keeps a journal: every call and its answer. After a crash, the workflow code runs again from the start; each call that already has an answer in the journal returns that answer instead of running again, until the code reaches the point where it stopped.
The strength is that the workflow is real code, with real loops and branches. The price is a set of rules: because the code runs again, it must take the same path every time. No reading the clock directly, no random numbers, no iterating a map whose order can change, no calls outside the SDK. These rules are checked while the code runs and by replay tests; a broken one can show up as a replay error, in production, after a deploy.
3. Code, made durable by the compiler
This is the family Cube Root belongs to. The workflow is plain Java or TypeScript, with no SDK calls. A compiler reads it and derives the graph of steps itself: which calls depend on which, what can run in parallel, what a try must undo. Each step that finishes is written as a row in PostgreSQL. After a crash, the work continues from the rows. The code is not run again from the start, so there is nothing to replay.
The strength is that the code stays plain and the rules are checked once, when it is compiled, before anything runs. The price is a compiler in the path, and one rule. The code is the whole language, Java, TypeScript or Python: compute goes in methods, effects in flows. A side effect, or anything that changes every time, such as the clock, is a flow of its own; what crosses a call must be serializable, since it is kept as a row.
Side by side
| Declared graph | Journal and replay | Compiler | |
|---|---|---|---|
| Examples | AWS Step Functions, Google Cloud Workflows | Temporal, Restate, Azure Durable Functions, AWS Lambda durable functions | Cube Root |
| How it is written | a graph in JSON or YAML | ordinary code calling the engine's SDK | plain Java or TypeScript |
| After a crash | the service continues the graph | the code runs again; finished calls are skipped | work continues from the rows |
| Rules on the code | few: the logic is in the graph | must stay deterministic; checked while running and by replay tests | checked by the compiler when the code is built |
| Parallel calls | declared states | written by hand (futures, promises) | derived from the data each call needs |
| The price | rich logic is hard to express | the rules live in the developer's head | one rule: compute in methods, effects in flows |
Why the difference matters
The second family made durable execution practical for application developers, and it is the reason the idea is now mainstream. Its central cost, the replay rules, is not a flaw in any one engine; it follows from replay itself. If the code runs again, it must behave the same way again.
Move the bookkeeping from run time to compile time and that cost changes shape. The question is no longer "will this code replay correctly next Tuesday?" but "does this code compile?", and the answer arrives in the editor, with the line.
Try it
Write a flow in the browser IDE at cube-root.com and choose View execution graph to see the steps the compiler derived. The full comparison, with ten yes-or-no questions per engine, is on how it compares.
Next in this series: a try that undoes what it finished.
Next articleA try that undoes what it finished