Durable execution is a way of running code so that a crash, a restart or a long wait doesn't lose its place: the program picks up from the last step it finished, with its state intact. It matters most for work with several steps that touch the outside world, such as taking a payment and then shipping an order.
What goes wrong without it
Picture an order service. For each order it charges the customer, waits for the payment provider to confirm, prepares the order and sends it. In ordinary code that is four lines in one function, and the only record of how far it got lives in memory.
Now the process dies between the charge and the delivery. A deploy restarts it, the machine runs out of memory, or the host reboots. The local variables are gone, and when the service comes back nothing knows the order was halfway through. Either the order sits stuck, with the customer charged and nothing sent, or someone retries it from the start and charges the customer twice.
The longer a process runs, the more likely this is. Waiting for a payment confirmation can take minutes. A sign-up flow that sends a reminder after three days has to survive every deploy in those three days.
The usual fixes, and why they hurt
Teams usually build the safety net by hand:
- a status column on the order row ('charged', 'prepared', 'sent'), updated after every step;
- retries with backoff around every network call;
- a queue between steps, so work survives a restart;
- a cron job that sweeps for orders stuck in one status for too long.
Each piece works. Together, they scatter a four-line idea across handlers, tables, queues and scheduled jobs. The business logic, charge then wait then prepare then deliver, becomes a state machine you maintain yourself, and every new step adds another status, another retry and another edge case to test. If you have built background jobs before, this will look familiar.
Wondering how this was made? How we make these