liveBook · Manning

Pessimistic view

As explained in Microservices Patterns, Second Edition

A pessimistic view is a saga design technique that orders steps to reduce business risk from observing intermediate or dirty data.

A pessimistic view is a saga design technique for reducing business risk when concurrent sagas can observe intermediate or dirty data. It reorders saga steps so that higher-risk effects are less exposed to anomalies caused by the absence of transaction isolation. section 9.3.2 section 9.4

The technique addresses a structural trade-off in saga execution. Sequential steps are straightforward, while parallel execution improves performance. Because a saga combines multiple ACID transactions without providing isolation across them, concurrent sagas can produce lost updates, dirty reads, and fuzzy reads. section 9.4

Use a pessimistic view when step ordering can materially reduce the business impact of those anomalies. It is one application-level countermeasure among several, rather than a replacement for every concurrency strategy. Other options include semantic locks, commutative updates, rereading values before overwriting them, and recording updates so they can be reordered. section 9.3.2 section 9.4

Evaluate the technique alongside the main forces shaping saga execution:

  • Prefer sequential execution when ordering is more important than performance. section 9.4
  • Consider parallel execution when improved performance justifies managing greater exposure to concurrent anomalies. section 9.4
  • Combine ordering with another countermeasure when reordering alone does not sufficiently control business risk. section 9.3.2

The central decision is not whether sagas can run concurrently, but how their ordering and other application-level controls should limit the consequences of missing isolation. Choose the simplest countermeasure that addresses the relevant business risk. section 9.3.2 section 9.4

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines step reordering and its motivation, but does not provide a concrete ordering algorithm or worked saga.
What it assumes
Assumes familiarity with sagas, ACID transactions, transaction isolation, and anomalies such as dirty reads and lost updates.
What you can do after
Apply it by reordering saga steps to reduce the impact of concurrent anomalies.
How it connects
Connects sagas with transaction isolation, parallel execution, semantic locks, commutative updates, rereading values, and version files.

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.