liveBook · Manning

Commutative update

As explained in Microservices Patterns, Second Edition

A commutative update is an update operation designed to produce an equivalent result regardless of the order in which compatible updates execute.

Sagas execute multiple ACID transactions without transaction isolation. Concurrent sagas can therefore produce lost updates, dirty reads, and fuzzy reads, making application-level countermeasures necessary. section 9.3.2 section 9.4

A commutative update designs an update operation so compatible operations can execute in any order and still produce an equivalent result. It is one countermeasure for missing isolation in sagas and other multi-database architectures. section 9.3.2

Use the technique as part of saga concurrency design:

  • Choose it when saga updates can safely be made order-independent, allowing concurrent execution without relying on distributed transactions. section 9.3.2
  • Compare it with semantic locks, pessimistic views, rereading values, and version files when selecting an application-level isolation mechanism. section 9.3.2 section 9.4
  • Prefer sequential saga steps when simpler reasoning and implementation outweigh the performance benefit of parallel execution. section 9.4

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines order-independent execution but stops short of a concrete implementation algorithm or worked commutative-update example.
What it assumes
Assumes familiarity with sagas, ACID transactions, concurrency anomalies, and the absence of distributed transaction isolation.
What you can do after
Apply commutative updates when designing saga operations that must tolerate concurrent execution without transaction isolation.
How it connects
Connects commutative updates to sagas, transaction isolation, distributed transactions, and application-level concurrency countermeasures.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.