liveBook · Manning

Countermeasure

As explained in Microservices Patterns, Second Edition

A saga countermeasure is an application-level design technique that reduces anomalies caused by the absence of isolation across saga transactions.

Sagas lack isolation across their ACID transactions, so concurrent execution can cause lost updates, dirty reads, and fuzzy reads. Countermeasures use application-level design to prevent these anomalies or reduce their business risk. section 9.3 section 9.4

Five useful strategies for saga-based microservices are:

  • Semantic lock — use an application-level lock. section 9.4
  • Commutative updates — design operations to work in any order. section 9.4
  • Pessimistic view — reorder saga steps to minimize business risk. section 9.4
  • Reread value — verify data is unchanged before overwriting it, preventing dirty writes. section 9.4
  • Version file — record updates so they can be reordered. section 9.4

How Microservices Patterns, Second Edition covers it

How deep it goes
Names five strategies and summarizes their roles without detailing implementation procedures.
Examples
Names semantic locks, commutative updates, pessimistic views, reread values, and version files.
What it assumes
Assumes familiarity with sagas composed of multiple ACID transactions and their lack of isolation.
What you can do after
Apply application-level strategies to prevent saga data anomalies or reduce their business risk.
How it connects
Connects saga transactions to isolation and anomalies including lost updates, dirty reads, and fuzzy reads.

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.