Distributed transaction

the lock can be held for a long time; the coordinator can be a single point of failure.

1 Reserve resources. 2 The coordinator collects replies, if all yes, do try-confirm; else do try-cancel.

The service maybe restarts in the middle of TC/C. Need to store the progress of a TC/C in a transactional database.

1 Each operation is an independent transaction on its own DB. 2 When one operation is finished, the next operation is triggered. 3 If one failed, roll back from the current to the first in reverse.
Saga executes linearly, TC/C could in parallel.

State machine: 1 validate commands and generate events; 2 apply the event to update the state

CRQS: Rather than publishing the state, event sourcing publishes all the events. The external world could rebuild the state by itself.
Independent scaling; Optimized data schemeā¦

Append-only data structure; cache recent commands and events in memory; use mmap to write to a local disk and cache recent content in memory at the same time.
