Understand the building blocks / CHAPTER 18
PACELC: normal-operation latency trade-offs
Compare what reads and writes wait for during normal communication, then define their behavior when communication fails.
Builds on CAP: consistency and availability during partitions, Redundancy and replication.
- Read PACELC as two conditional questions.
- Trace local and coordinated replicated operations.
- Avoid treating PACELC labels as complete product specifications.
01Ask a second question while the network works
Nia changes her public display name at East. West has not received the change yet, even though the network is working. Should a West read wait, or may it briefly show the earlier name?
CAP addresses a limit during broken communication. PACELC adds a question about ordinary operation:
- If there is a Partition, ask which operations can remain Available and which Consistency promise they keep.
- Else, while communication works, ask how the required Consistency changes Latency: the elapsed time before the caller gets a result.
The letters form a discussion framework, not a complete database specification. Name the operation and follow its messages. A database label supplies neither its exact delay nor every configuration’s guarantee.
For this example, Nia’s change produces profile version 8; West still has version 7. For this exercise, a public avatar copy may be reused for 30 seconds after a successful refresh from East. Private-document reads instead check the saved access grant; a completed revocation must be reflected by that check.
- West can return its avatar copy while that refresh age is within 30 seconds. Once it expires, West refreshes from East or returns an unavailable response.
- Before returning private bytes, the service reads the account’s grant through the permission store’s linearizable read. That read must reflect completed revocations; a cached older grant cannot replace it.
- Some operations can combine independent changes without the same coordination as an exclusive claim. Do not assume every stronger guarantee has one universal communication cost.
02Trace a normal update before discussing failure
Assume a cross-region round trip takes 80 ms for this exercise. That is a planning input, not a production measurement.
Trace local acceptance:
- East safely saves version
8. - East reports success before West receives it.
- A West read can still return 7 if its stated freshness rule allows that result.
Trace a more coordinated path:
- In this one-writer example, East accepts profile changes and sends version
8to West. - West saves and applies
8, then replies with that applied version. Merely receiving bytes would not make its normal queries show the change. - East waits for that reply before acknowledging the update. A subsequent West query can now observe
8; the client paid the remote waiting cost to obtain this read-after-write behavior. - Count the actual exchanges, processing, and queueing. The assumed 80 ms round trip does not mean every coordinated operation adds exactly 80 ms, or that this short trace implements every rule needed for global linearizability.
A request can also require a minimum version without demanding a globally current read for every user:
- East’s update response gives Nia version
8. - Nia’s next read asks for “at least version
8.” This number is a freshness requirement, not permission to read private data. - The read handler checks the replica’s applied version. If it is
7, wait within the caller’s deadline or route to a source whose applied version is at least8. If neither is possible, return an unavailable response; do not return7as success. - If another user later completes version
9, a minimum-8 request alone does not demand 9. The guarantee is narrower than one current order respected by every client.
For every path, state the source, the required state, the communication needed, and the failure response.
03Apply both branches to one user promise
Apply both branches to the two profile operations.
While communication works
- West may reuse its public avatar copy for 30 seconds after the last successful refresh from East. Nia’s edit can therefore appear later at West.
- A private-document read asks the permission store whether this account’s grant is active, using the linearizable read described above. Waiting for that answer adds delay and makes the permission store necessary for completion.
- A minimum-version request must meet that explicit version even if an ordinary avatar read would allow an older one.
When communication fails
- Identify which source or permission check is unreachable.
- Serve West’s public avatar only while its last successful refresh is at most 30 seconds old. If the copy expires and East cannot be reached, return unavailable instead of reusing it indefinitely.
- If the permission-store read does not complete within the request’s deadline, refuse the protected read without returning bytes. An old cached grant does not answer whether access was revoked.
- If local updates may still complete, save them and define how conflicting accepted changes are combined or resolved after reconnection.
Verify ordinary delay as well as disconnection:
- Inject delay into the actual coordination path, not only a local test endpoint.
- Measure the entire user operation, including catching up, redirects, and retries.
- Check the response when the required version does not arrive before the deadline.
- Reconnect regions that accepted different changes and inspect the combined result.
PACELC is useful when it connects a promised observation to an actual request path and exposes what that path costs on a healthy network.
PACELC has a failure branch and a normal branch
Follow the numbered arrows
- Network condition → Partitionedif required messages unavailable
- Network condition → Communicatingelse
- Partitioned → Failure policychoose behavior per promise
- Communicating → Local pathwhen contract permits
- Communicating → Coordinated pathwhen guarantee requires
Trace the diagram in words
- Name the read or write and what its caller must observe.
- While communication works, trace local and coordinated paths and measure their waiting.
- When communication fails, specify the allowed result or wait/refusal behavior.
DRAW. CALCULATE. EXPLAIN.
Compare avatar and revocation reads
20 minutes · guided practice
East saves profile version 8 while West still has 7. The link first becomes slow, then stops carrying required messages.
- Define a public-avatar policy that allows brief staleness.
- Define the behavior of a request explicitly requiring at least 8.
- Define a private-document read that must establish current permission.
Compare the worked solution
- Use the exercise’s 30-second reuse limit measured from the last successful refresh from East. West can return that copy within the limit; after expiry, it refreshes or returns unavailable. The choice permits some old avatar reads while avoiding remote waiting on every hit.
- A minimum-8 request checks the source’s applied version. Wait within the deadline for at least
8, route to another source known to have applied at least8, or return unavailable;7is not a successful result. - For the private document, read this account’s active grant through the permission store’s linearizable read. If that read is slow, wait only within the request deadline. If isolation prevents it from completing, return no protected bytes; a cached grant cannot substitute for a revocation-aware read.
- Measure each complete path, including version waiting and redirection. The number of copies alone establishes neither response time nor freshness.
The checkboxes record your own assessment. The worked solution gives you a way to check the reasoning.
RETRIEVE BEFORE YOU REVEAL
Keep the important ideas.
Say the answer aloud, then turn the card over.
CARD 01What does PACELC ask?
- During a partition, ask which requests complete and what consistency they retain.
- During normal communication, identify the messages needed for the promised observation.
- Measure how waiting for those messages changes the whole operation’s response time.
CARD 02What does a minimum-version token do?
- The update returns version 8.
- The next request asks for at least 8.
- Check the chosen replica’s applied version. At 7, wait or route to a replica that has applied at least 8; otherwise return unavailable before the deadline.
This does not automatically require every client to see the latest globally completed update.
CARD 03How do I choose per operation?
- An older public avatar can be acceptable within its age limit.
- An old access grant after revocation can disclose private bytes.
Choose the read source and failure behavior from that consequence, then measure the complete request.
CHECK THE REASONING
Can you explain the choice?
Answer every question, then finish for an immediate score and an explanation for each answer. Aim for 80%, then revisit any gaps.
CLOSE THE LOOP
Explain it without the page.
Summarise the mechanism, one trade-off, and one failure mode. Then mark this chapter complete.