Search⌘ K
AI Features

Long-Lived Transactions and Sagas

Explore how long-lived transactions impact performance and learn the saga pattern to maintain atomicity without full isolation. Understand compensating transactions, application-layer isolation techniques, and trade-offs in designing distributed transaction workflows.

As explained previously, achieving complete isolation between transactions is relatively expensive.

The system either has to maintain locks for each transaction and potentially block other concurrent transactions from making progress, or abort some transactions to maintain safety, which leads to some wasted effort.

Furthermore, the longer the duration of a transaction is the bigger the impact of these mechanisms is expected to be on the overall throughput.

There is also a positive feedback cycle: using these mechanisms can cause transactions to take longer, which can increase the impact of these mechanisms.

Long-lived transactions

There is a specific class of transactions, called long-lived transactions (LLT).

These are transactions that by their nature have a longer duration in the order of hours or even days, instead of milliseconds. This can happen because this transaction processes a large amount of data, requires human input to proceed, or needs to communicate with third party systems that are slow.

Examples of LLTs

  • Batch jobs that calculate reports over big datasets
  • Claims at an
...