ModelChapter II · Distribution · Building block 4 of 6

CAP & PACELC

CAP describes the conflict between consistent responses and availability during a network partition. The partition is the situation in which separate nodes do not communicate.

  1. PartitionRegions are not reaching.
  2. ConsistencyCommon view before adoption.
  3. AvailabilityAcceptance despite separation.

Context

Why this is important

When regions are separated, a system cannot simultaneously keep every response consistent and every request available. Without conscious choice, chance decides what customers experience in the shopping cart. Consistency models deepen your own building blocks.

This building block arranges promises for network partitions. Quorum considers concrete read and write confirmations; consensus arranges binding states.

At a glance · Partition forces a choice

With separated regions, the system must either preserve consistency or offer availability.
Shop example · Playing through scenarios

Cart change in network partition

The shopping cart is replicated in two regions. While the regions are separate, the shop decides whether changes to the shopping cart positions are accepted locally or deferred until a common view.

This is how you read the picture

  1. Partition For “separate” region B is on “without opposite”.
  2. Consistency If there is consistency, the cart change waits and blocks temporarily.
  3. Availability If available, the change is stored locally, the merger follows later.
Connection between regions
Priority
  • runningRegion AAccepts change
  • runningRegion Bhas the same status
  • runningCart changeImmediately accepted
  • runningMergingnot necessary

immediatelyAdoption of the amendment

As long as the regions reach each other, there is no conflict of aims. Both regions have the same view of the shopping cart.

Cap the connection and select the priority. You can see if the change is waiting or accepted locally.

Benefits & limitations

Helps if:

  • Distributed access across replicas needs a clear account of which responses remain available during a network partition.
  • During normal operation, PACELC adds the trade-off between latency and consistency.
  • Different operations receive different guarantees, each defined for the specific access.

Boundaries

  • CAP applies during a partition; without a partition, this particular trade-off does not arise and both guarantees are possible.
  • Make the choice per operation rather than for the whole system: cart updates and order completion may have different priorities.
  • Choosing availability requires a conflict-resolution rule after the partition; Replication and Consistency define how states are reconciled.

In practice

  1. Relate the claim to a specific operation, partition and consistency guarantee. Then determine which requests are answered or deferred during the partition.
  2. Distinguish a partition from normal operation and document the chosen trade-off for each. PACELC adds the latency–consistency question when there is no partition.
  3. Test the actual replica group and configuration under a network partition. Consistency models defines what reads can observe; Quorum explains acknowledgement thresholds.
Read the detailed explanation

During a network partition, a distributed service must trade off linearisable responses against response availability at reachable nodes for each request. PACELC adds the trade-off between latency and consistency during normal operation.

These terms must refer to a specific consistency model and an individual operation. CAP is not a general choice of two system properties; configuration, replica groups and failure domains determine the actual guarantee.

Consistency models define the visibility of an operation; Quorum describes response thresholds available in a replica configuration. CAP concerns the trade-off during a partition.

The CAP theorem originated with Eric Brewer.

Check your understanding

Test yourself in three stages

  1. ReadingCheck in the picture

    What happens to separate regions if availability takes priority?

    View the solution with justification

    The region accepts the change locally. Conflicts are later merged via the conflict rule.

  2. ApplyingTransferred to a new situation

    Customers should be able to add cups in the shopping cart even during a separation. What priority does the shop choose, and what follows?

    View the solution with justification

    It prioritizes availability. The region accepts the change locally and settles conflicts after the separation via the defined conflict rule.

  3. EvaluateWeighing an alternative

    The shop prioritizes consistency for cart changes. What is the advantage and disadvantage of this?

    View the solution with justification

    Advantage: After the joint examination, there is a clear status without subsequent comparison. Disadvantage: Changes can temporarily block during separation, the shopping cart is then less usable.

Continue on the learning path

Next in Distributed systems: Quorum.

6 Building blocks

Continue withQuorum