liveBook · Manning

Consistency

As explained in Grokking Software Architecture

Consistency is the property that observations of distributed data conform to a defined agreement about its current state.

Two ticket servers need to agree on how many seats remain. If they lose contact, can either server keep selling safely? Consistency is about observations of data conforming to an agreed view of its current state. The stricter that agreement, the more a system may have to wait when its parts cannot communicate. section 2.9

A cable break and the last ticket

New York and London servers lose their connection. New York can refuse a sale until it can confirm availability with London, preserving a common view but leaving the customer waiting. Or it can sell the ticket and stay available, risking a double sale if London has already sold the last seat. section 2.9

This is the tradeoff illustrated by the CAP theorem: during a network partition, preserving consistency can mean refusing or delaying a request, while serving it can risk conflicting data. The right choice depends on the consequences. A bank transfer favors a correct balance over a slight delay; a social feed can often tolerate a stale post rather than show an error. section 2.9 section 2.9.1

A faster dashboard with older data

A dashboard can check a cache before running slow database queries. That makes repeat requests faster, but a new order may not appear until the cached entry expires—up to 10 minutes in this example. Ask the business whether that delay is acceptable in exchange for the speed gain. section 2.4.4

Figure 2.8 By checking a fast cache first, the system avoids expensive database queries. A Cache Miss creates a temporary delay to fetch and save data, but each subsequent request becomes nearly instantaneous.

Follow the cache hit and miss paths that make the dashboard faster while allowing cached data to become stale. section 2.4.4

Consistency also becomes a concern when microservices keep separate databases: independent deployment and scaling come with the work of managing distributed data. Make the tradeoff explicit rather than assuming the most up-to-date view is always worth the cost. section 12.2.2 section 1.10

How Grokking Software Architecture covers it

How deep it goes
Explains partition and caching tradeoffs through scenarios, without requiring readers to design distributed databases.
Examples
Illustrates ticket overselling, stale dashboard caches, bank balances, and social feeds.
What you can do after
Evaluate/understand whether stale data or delayed responses better fit a business need.
How it connects
Connects consistency with CAP theorem, availability, network partitions, caching, performance, and microservices.

Also explained in

Compare how 28 books explain consistency →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.