ConceptChapter II · Data · Building block 4 of 9

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.

  1. StrongEveryone reads the new stand immediately.
  2. Read-your-writesAnyone who writes reads their own change.
  3. 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

A change does not reach the copies at the same time, so a reader sees old or new state depending on the copy.
Shop example · Visibility over time

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

  1. Strong All three readers point to second 0 to the new address.
  2. Read-your-writes The customer immediately sees new, service and shipping only from second 2.
  3. Eventual Before the second 2 see the old value, from second 2 the new one.
The customer changes the delivery address of the order.Port road 12, Hamburg → Lindenweg 5, Bremen
  • 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

Choose consistency model and time; marked in red where a reader sees an old value even though he needs the new one (times and addresses illustrative).

Two Consistency Requirements in the Shop

Two Consistency Requirements in the Shop
AspectsReservationCustomer Service Overview
DecisionStock CompulsoryInformation on status
Obsolete valueCan cause double allocationTemporary old status
CommitmentCurrent state of playSubsequent update allowed
ReactionRejecting conflictShow time of view
Reservation and customer service overview need different current stands in the same shop.

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

  1. Formulate the visibility commitment per read and write operation. Determine which order applies and which intermediate status is permissible for consumers.
  2. Check competing changes and replica delay under real-world failure conditions. The consistency model must remain derivable from observable behaviour.
  3. 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

  1. 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.

  2. 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.

  3. 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.