The easiest way to think about durable execution is as code that runs until completion, even in the presence of external failure. The external failure

Introduction to durable execution

submited by
Style Pass
2024-10-03 21:30:09

The easiest way to think about durable execution is as code that runs until completion, even in the presence of external failure. The external failure part is very important.

Rust as a language already pushes developers to explicitly handle errors. Almost every API touching the operating system can fail and returns a Result, letting the developer decide what should happen in that case. This is great! But there are some failure scenarios that we can't handle directly from code. For example, if the process executing the code is shut down. Can't if-else a kill -9. That's what I like to call an external failure. Flawless gives us tools to deal with such failures directly from code.

This is a fairly straight forward function. It charges the credit card of a user, sends an invoice to the same user and extends their subscription. And in the majority of cases it will work just fine. However, there are a few cases where it might fail, or even worse, leave the system in an inconsistent state.

One such case would be if the VM is restarted by an administrator to apply a security update. Right at the moment when this function is executing! Maybe the credit card was charged, but the code to extend the subscription was never called. Resulting in a very upset customer.

Leave a Comment