Data Consistency in Distributed Systems
- 53Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What does consistency mean when data is stored in multiple copies?
53 questions
- 1
What does consistency mean when data is stored in multiple copies?
Model answer
Consistency means that the copies contain the same data.
Explanation
The central consistency requirement is that replicated copies match.
- 2
In which two distributed-systems contexts does consistency commonly arise?
Model answer
It is discussed in the CAP theorem and in database transactions.
Explanation
Consistency is a central concern in both distributed-system tradeoffs and transaction processing.
- 3
How does a single-server system respond when one user requests another user's profile?
Model answer
The server looks up the profile in its single data copy and returns it to the requesting user.
Explanation
With one copy of the data, the server can answer a profile request by reading that copy.
- 4
Why is a single server a single point of failure?
Model answer
If the server or its supporting infrastructure fails, the entire system may become unavailable, and its data may be lost.
Explanation
A single server leaves no alternate location to serve the system if it goes down.
- 5
Why does vertical scaling eventually become an impractical solution for a single server?
Model answer
Increasing one computer's capacity becomes increasingly costly and eventually reaches a limit.
Explanation
The system cannot keep adding capacity to one machine indefinitely, and very powerful machines are expensive.
- 6
Why can a centralized server create high latency for users in distant regions?
Model answer
Requests must travel over long distances and through network routers to reach the server, increasing response time.
Explanation
Geographic distance and the network path add delay to communication with a remote server.
- 7
What are the three main problems with relying on one centralized server described in the example?
Model answer
It creates a single point of failure, has limited and costly vertical scaling, and can produce high latency for distant users.
Explanation
These are the reliability, capacity, and response-time limitations motivating a distributed design.
- 8
What is the limitation of placing separate servers in different regions while keeping their data independent?
Model answer
Users can access data local to their region, but the regions cannot share data with one another.
Explanation
Independent regional copies may suit isolated use cases, but they do not support cross-region data sharing.
- 9
Why might a product deliberately keep regional data separate?
Model answer
It may be acceptable if users only need information relevant to their own region or community.
Explanation
The example suggests separate campus data could work for a product focused only on local events.
- 10
What happens to latency when a user must directly contact a server in another region?
Model answer
Latency remains high because the request still has to travel across the distance between regions.
Explanation
Separating data by region does not make remote requests faster when the data is still available only on the distant server.
- 11
How can caching information from a distant region reduce response latency?
Model answer
A nearby server can store a copy of requested information and serve later requests locally.
Explanation
After the information is fetched once from the remote server, subsequent requests can be answered from the local cache.
- 12
Describe what happens when a local cache misses for a requested profile.
Model answer
The local server requests the profile from the remote server, stores the returned profile in its cache, and sends it to the user.
Explanation
The remote fetch supplies the missing data and can populate the cache for later requests.
- 13
Why does caching reduce latency without eliminating it?
Model answer
A cache hit can be served locally, but a cache miss still requires a remote request; replacement can also remove an item and cause a miss.
Explanation
Caching improves common requests, but it cannot guarantee that every requested item will be present.
- 14
How do multiple copies of data in different regions help when one server fails?
Model answer
If one server fails, users may be able to access the data from another server holding a copy.
Explanation
Replication provides an alternative location for data when a server becomes unavailable.
- 15
How can geographically distributed copies improve access for users far from the original data location?
Model answer
Users can access a nearby copy instead of making every request to a distant server.
Explanation
A local replica can reduce the distance a request must travel and therefore lower latency.
- 16
What consistency challenge appears when an update is made to only one of several data copies?
Model answer
The update must be propagated to the other copies so that they do not remain different.
Explanation
Replication helps availability and latency, but copies must be coordinated after changes.
- 17
How can manually propagating updates be appropriate for some systems?
Model answer
It may be acceptable when updates are infrequent and users can tolerate a delay before all copies are updated.
Explanation
The content gives infrequent updates as a case where manual propagation may be a reasonable choice.
- 18
How does the bank-account example illustrate delayed consistency?
Model answer
Account changes may be recorded and spread through the system later, so a statement may take days to reflect them in the worst case.
Explanation
The example shows that some systems tolerate delayed propagation of updates.
- 19
Why is slow, manual update propagation unsuitable for a real-time service such as a social network?
Model answer
Users expect changes to become visible quickly, so waiting a long time for copies to be updated is unacceptable.
Explanation
The content contrasts bank-statement delays with systems that need rapid responses to changes.
- 20
Why might a system use TCP to send updates between replicas?
Model answer
TCP provides reliable and ordered delivery of messages.
Explanation
Those properties make TCP a useful option for transmitting replica updates.
- 21
What does an update message such as “change C to C++” instruct a receiving replica to do?
Model answer
It instructs the replica to change its stored value from C to C++.
Explanation
The example treats the message as an operation to apply to the receiver's local database.
- 22
Why does a sender need an acknowledgement after transmitting an update?
Model answer
Without an acknowledgement, the sender cannot know whether the receiver got and applied the update.
Explanation
The receiver's acknowledgement provides evidence that the update reached it.
- 23
What are two possible retry policies when an update acknowledgement does not arrive?
Model answer
The sender can retry indefinitely until the update succeeds, or retry a limited number of times and then give up.
Explanation
The content describes both repeated retries and a fixed retry limit as possible choices.
- 24
What consistency risk arises if a sender gives up retrying an update?
Model answer
The copies may remain inconsistent because the receiver may never have applied the update.
Explanation
Stopping retries without confirming delivery can leave one copy with the old value.
- 25
What fundamental uncertainty remains when a system relies on acknowledgements over an unreliable network?
Model answer
The sender cannot always know whether an update or its acknowledgement was lost, even if the receiver committed the update.
Explanation
Network failures make it uncertain whether the other system received a message or whether a response reached the sender.
- 26
Why does making a local commit before a peer confirms the update create a coordination problem?
Model answer
The local system has committed, but the peer may not receive or commit the update, leaving the copies different.
Explanation
A committed local change cannot rely on an uncertain network message to ensure that another system also commits.
- 27
Why does waiting for a peer to commit not remove the acknowledgement problem?
Model answer
The peer can commit but still cannot know whether its acknowledgement will reach the original system.
Explanation
The same uncertainty about message delivery applies in the reverse direction.
- 28
Why can repeatedly acknowledging acknowledgements fail to provide absolute certainty?
Model answer
Each new acknowledgement can itself be lost, leading to an endless chain of confirmations.
Explanation
Adding another confirmation does not eliminate the underlying possibility of message loss.
- 29
What problem does the acknowledgement dilemma illustrate?
Model answer
It illustrates the Two Generals Problem: parties communicating over an unreliable network cannot be certain that their messages and confirmations have been received.
Explanation
The example uses the problem to show why a commit cannot be based on guaranteed receipt of an acknowledgement.
- 30
How does assigning one server the leader role simplify replicated writes?
Model answer
Only the leader accepts writes, so updates have one authoritative point of entry before being sent to followers.
Explanation
Centralizing write responsibility avoids allowing multiple servers to independently initiate database changes.
- 31
In a leader-follower system, what roles do the leader and follower play in the example?
Model answer
The leader accepts and commits writes, then sends updates to the follower; the follower receives updates and can serve reads.
Explanation
The example makes the leader the write location and the follower a replicated read location.
- 32
How can a follower return stale data in a leader-follower system?
Model answer
If an update from the leader has not reached the follower, a read from the follower may return the old value.
Explanation
Replication delay can leave the follower behind the leader.
- 33
What is the availability cost of waiting for a follower's update before serving a read?
Model answer
The read may have to wait and provide no response while the update is delayed, making the system unavailable to that request.
Explanation
Waiting for consistency can prevent the system from responding promptly.
- 34
What tradeoff does the example describe between consistency and availability?
Model answer
Requiring consistent data can make the system unavailable while it waits for updates, whereas serving requests despite delays can expose inconsistent data.
Explanation
The example frames consistency and availability as competing goals when communication is unreliable.
- 35
What is the purpose of the prepare phase in two-phase commit?
Model answer
The leader asks each participant to perform the transaction's work but wait before making it final.
Explanation
A participant's prepare acknowledgement indicates that it has completed the preparatory work and is ready to commit.
- 36
What does a participant communicate when it acknowledges a prepare request?
Model answer
It communicates that it received the request, completed the required preparation, and is ready to commit.
Explanation
The acknowledgement allows the leader to determine whether participants are prepared for the transaction.
- 37
What does the leader do after receiving prepare acknowledgements from all participants?
Model answer
It sends commit instructions to the participants.
Explanation
The second phase directs the prepared participants to finalize the transaction.
- 38
How are multiple statements handled during a prepared database transaction?
Model answer
The database begins a transaction and executes the required statements, but does not make the changes final until it receives a commit.
Explanation
The prepare stage performs the work while leaving the transaction uncommitted.
- 39
What does committing a transaction make happen to its changes?
Model answer
It makes the changes final so they can be reflected to users reading the data.
Explanation
The content compares commit to saving the transaction's changes in the database.
- 40
What should the leader do if a participant rejects a prepare request or fails to respond before the timeout?
Model answer
The leader should abort the transaction and direct the participants to roll back.
Explanation
A negative response or timeout indicates that the leader cannot proceed with the transaction across all participants.
- 41
Why is rollback needed when a prepared transaction is aborted?
Model answer
Rollback restores the previous data, undoing the transaction's uncommitted changes.
Explanation
For example, it can change a prepared value from C++ back to C.
- 42
Who determines whether participants should roll back in the described two-phase commit approach?
Model answer
The leader directs participants to roll back; followers do not independently decide to roll back based only on a timeout.
Explanation
The leader coordinates the transaction outcome and informs the followers of that decision.
- 43
What can a follower do if it receives a commit message but its acknowledgement is lost?
Model answer
The leader can retry the commit message, and the follower can recognize a repeated commit for the same transaction ID and acknowledge it.
Explanation
The transaction ID helps distinguish a retry of an already handled commit from a new transaction.
- 44
How does using a transaction ID make repeated commit requests safer?
Model answer
It lets the system recognize repeated requests for the same transaction and handle them without applying a new, unintended transaction.
Explanation
The content describes this property as making the operation idempotent.
- 45
Why can a follower not simply roll back on its own after a commit message seems delayed?
Model answer
The commit may have succeeded while only its acknowledgement was lost, so an independent rollback could make the follower disagree with the leader.
Explanation
A timeout alone does not prove that the other system failed to commit.
- 46
What inconsistency can occur if the leader commits an update but a follower does not receive the commit?
Model answer
The leader may show the new value while the follower still shows the old value.
Explanation
Different commit outcomes across replicas produce different results for reads.
- 47
How can locks help prevent reads from exposing a partially committed update?
Model answer
The system can block reads and writes to the affected data until the transaction's outcome is resolved.
Explanation
Blocking access prevents users from observing conflicting values while replicas are not yet aligned.
- 48
What is the availability cost of locking data during a distributed commit?
Model answer
Requests for the locked data may have to wait or fail, so the system is unavailable for those operations.
Explanation
The example notes that users may receive no result from a read while the lock is held.
- 49
Besides reduced availability, what other costs can strict consistency impose?
Model answer
It can reduce performance and increase the physical cost of the system.
Explanation
The content identifies availability, performance, and system cost as possible consequences of strong consistency.
- 50
When might a system choose the strict coordination of two-phase commit?
Model answer
It may be appropriate when absolute consistency is important, such as in a financial system.
Explanation
The example presents financial systems as a case where the consistency benefit may justify the availability cost.
- 51
What is eventual consistency, as suggested by the examples of delayed update propagation?
Model answer
It is an approach in which copies may temporarily differ, but updates are propagated so they can become consistent later.
Explanation
The content contrasts immediate, strict consistency with systems that spread updates over time.
- 52
Why might a system choose eventual consistency instead of strict consistency?
Model answer
It may avoid the availability and performance costs of blocking operations while replicas wait for every update to be confirmed.
Explanation
The content presents eventual consistency as a more practical alternative when perfect consistency is too costly.
- 53
What does the content say eventual consistency is closely associated with?
Model answer
It is closely associated with isolation and with guarantees for reading and writing data.
Explanation
These concepts are identified as related aspects of how distributed systems handle data operations.

Ask anything
We've read this whole study set, so questions about it get the best answers.