Consistency models
Consistency models describe when and in what order changes become observable. The appropriate promise depends on the business effect of a reading or writing.
- StrongEveryone reads the new stand immediately.
- Read-your-writesAnyone who writes reads their own change.
- EventualCopies later resemble each other.
Context
Why this is important
A promise that is too weak leads to wrong decisions such as the package to the old address or double allocation; too much leads to unnecessary costs. Choose the commitment per reader according to the business effect. Copies of data and their default are a separate building block, replication.
This building block explains visibility and order of changes. For copies of data and their update delay, see replication.
At a glance · Writes and reads with delay
Who sees the new delivery address when?
The warehouse reservation must check the current stock binding. A customer service overview may show the new shipping status a few seconds later.
This is how you read the picture
- Strong All three readers point to second 0 to the new address.
- Read-your-writes The customer immediately sees new, service and shipping only from second 2.
- Eventual Before the second 2 see the old value, from second 2 the new one.
CustomerReloads your order page
Delivery address B-1042Port road 12, Hamburg
Old – Wrong for this need
Need: Read-your-writes · Must see her own change immediately, otherwise she will change again.
Customer serviceSee the overview of orders
Delivery address B-1042Port road 12, Hamburg
Old, allowed
Need: Eventual · May briefly show the old state and indicate the time of the view.
ShippingPrints the shipping label
Delivery address B-1042Port road 12, Hamburg
Old – Wrong for this need
Need: Highly · Needs the relevant status, otherwise the package goes to the old address.
Times and Addresses illustrative
Two Consistency Requirements in the Shop
| Aspects | Reservation | Customer Service Overview |
|---|---|---|
| Decision | Stock Compulsory | Information on status |
| Obsolete value | Can cause double allocation | Temporary old status |
| Commitment | Current state of play | Subsequent update allowed |
| Reaction | Rejecting conflict | Show time of view |
Benefits & limitations
Helps if:
- A consistency model provides an explicit visibility guarantee for differing freshness and response time requirements.
- A clear sequence of competing changes can be guaranteed with a suitable consistency model.
- Accepted read delay allows for weaker models that can improve latency or availability.
Boundaries
- Strong visibility costs response time or availability if copies are unavailable; see CAP & PACELC.
- Weaker models may temporarily return old values; authoritative decisions such as label printing must read authoritative state.
- Read-your-writes requires session binding or reading at the writer; this costs additional routing logic.
In practice
- Formulate the visibility commitment per read and write operation. Determine which order applies and which intermediate status is permissible for consumers.
- Check competing changes and replica delay under real-world failure conditions. The consistency model must remain derivable from observable behaviour.
- Document the response time and availability costs of the chosen guarantee. Replication explains copies; CAP & PACELC examines trade-offs during partitions and normal operation.
Read the detailed explanation
A consistency model defines which states readers may observe after changes and how operations are ordered. Linearizability orders operations as though they occurred one at a time in accordance with real time. Weaker models permit intermediate states or differing observations.
Assess consistency for each operation and access path. It does not automatically imply business correctness: a stale value may be formally valid but unsuitable for a decision. The visibility guarantee affects latency, availability and user behaviour.
Replication distributes copies of data across nodes; CAP & PACELC explains the resulting trade-offs during partitions and normal operation.
Eventual Consistency means copies converge over time; Read-your-Writes means a writer can subsequently read its own changes. In the shop, the customer service overview may briefly lag, but stock reservations must use authoritative state.
Check your understanding
Test yourself in three stages
ReadingCheck in the picture
The model is eventual, the time 1 Second after the change. Who sees which address?
View the solution with justification
All three still see port road 12, Hamburg For customer service this is allowed, for customer and shipping it is wrong.
ApplyingTransferred to a new situation
Which model is at least sufficient for the customer and shipping to see correctly?
View the solution with justification
Strong for the shipping path, for the customer at least read-your-writes. The promise applies to each reading path, not to the entire shop.
EvaluateWeighing an alternative
Should the whole shop read strongly consistently so that no one ever sees an old value?
View the solution with justification
This avoids old values everywhere, but costs response time and availability even where an old status is harmless, for example in the service overview. Recommendation: strong only for paths with binding decision, otherwise weaker.
Explore further
These building blocks continue the thoughts of this page.
References
- PostgreSQL · Transaction isolation (opens in new tab)Compares insulation levels and allowed concurrent effects.
- AWS · DynamoDB Read Consistency (opens in new tab)Differentiates strong and eventual consistent reading operations.
- PostgreSQL · Log Shipping Standby Servers (opens in new tab)Explains synchronous and asynchronous replication with failover.