Data Consistency in Distributed Systems
- 36Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
In a distributed system with multiple copies of a data item, what does consistency generally require?
In a distributed system with multiple copies of a data item, what does consistency generally require?
36 questions
- 1
In a distributed system with multiple copies of a data item, what does consistency generally require?
- A
The copies are accessed by the same users
- B
The copies are updated at exactly the same time
- C
The copies are stored in the same location
- D
The copies contain the same data
Correct answer
DThe copies contain the same data
Explanation
Consistency generally means that multiple copies of data match. The system may need mechanisms to propagate updates so that the copies agree.
- A
- 2
Why is a single-server design a single point of failure?
- A
A failure of a database query forces the server to scale vertically
- B
A failure of that server can make the entire system unavailable
- C
A failure of the network makes the server store duplicate data
- D
A failure of one user account can erase every user's data
Correct answer
BA failure of that server can make the entire system unavailable
Explanation
When the system relies on one server, an outage of that server can take down the whole system. There is no other server available to serve the data.
- A
- 3
What is a key limitation of relying on vertical scaling for a single server?
- A
It automatically creates copies of data in other regions
- B
It guarantees that server failures cannot interrupt service
- C
It becomes costly and eventually reaches a capacity limit
- D
It reduces the distance between users and the server
Correct answer
CIt becomes costly and eventually reaches a capacity limit
Explanation
Vertical scaling increases the capacity of one machine, but the cost can become high and the machine eventually reaches practical limits.
- A
- 4
Why can a single server create high latency for users on another continent?
- A
Their requests must be copied to every local server before being processed
- B
Their requests must travel a long network distance to reach that server
- C
Their server must perform vertical scaling before returning each result
- D
Their data must be deleted from the server after each response
Correct answer
BTheir requests must travel a long network distance to reach that server
Explanation
A geographically distant user may need to send requests across many network links to reach the single server, increasing response time.
- A
- 5
What limitation results when separate regional servers keep only data relevant to their own campuses and do not communicate?
- A
Each server must store an identical copy of all regional data
- B
Local users cannot retrieve data stored on their own server
- C
Every request must be routed through a single global server
- D
Users cannot share or retrieve data held only in another region
Correct answer
DUsers cannot share or retrieve data held only in another region
Explanation
With no communication or data sharing between the regional servers, each region can serve its own data but cannot provide access to data held only by another region.
- A
- 6
If a regional server keeps its data locally but allows users from another region to contact it directly, which problem remains for those remote users?
- A
Their requests cannot retrieve data unless every server stores a full copy
- B
Their requests still have to travel a long distance, and the remote server can fail
- C
Their local server must stop serving users from its own region
- D
Their data is guaranteed to become consistent without any update mechanism
Correct answer
BTheir requests still have to travel a long distance, and the remote server can fail
Explanation
Direct access can make remote data available without copying it locally, but it does not remove the network distance or the risk that the remote server is unavailable.
- A
- 7
What is the main benefit of caching a frequently requested remote profile near a user?
- A
It ensures every request is processed by the same server
- B
It removes the need to maintain the original data in its home region
- C
It guarantees that the cached copy can never become outdated
- D
It can reduce the need for repeated requests to the distant server
Correct answer
DIt can reduce the need for repeated requests to the distant server
Explanation
Once a remote profile is cached locally, subsequent requests can be served nearby, reducing latency for those requests.
- A
- 8
Why does caching reduce latency without eliminating it?
- A
A cache can only store data that has never been requested before
- B
A local cache makes the remote server slower for every request
- C
Every cached item must be sent to the remote server before it can be read
- D
A requested item may be missing from the cache or may have been replaced
Correct answer
DA requested item may be missing from the cache or may have been replaced
Explanation
A cache miss occurs when the requested item is not present, including when it has been replaced. The system then needs to fetch the item from the remote server.
- A
- 9
How can storing copies of data in multiple regions reduce the impact of a server failure?
- A
All user requests are forced to wait until the failed server recovers
- B
Every update is guaranteed to reach all copies instantly
- C
Users may be able to access a surviving copy from another region
- D
The failed server is prevented from losing power or network access
Correct answer
CUsers may be able to access a surviving copy from another region
Explanation
If one server fails but another holds a copy of the data, users may still be able to access that surviving copy.
- A
- 10
How can regional replicas help reduce latency for users who need data associated with another region?
- A
They guarantee that every regional copy is always identical
- B
They eliminate the need to send any updates between regions
- C
They can provide a nearby copy instead of requiring every read to cross the ocean
- D
They ensure that users only access data from its original server
Correct answer
CThey can provide a nearby copy instead of requiring every read to cross the ocean
Explanation
A nearby replica can serve a request locally, avoiding the long trip to the data's original region. The replicas still need an update mechanism to stay consistent.
- A
- 11
After one replica is updated, what must happen for another replica to reflect the same change?
- A
The update must be propagated to the other replica
- B
The update must be converted into a cache miss
- C
The updated replica must stop accepting all future requests
- D
The other replica must be deleted and recreated in the same location
Correct answer
AThe update must be propagated to the other replica
Explanation
A change made to one copy needs to be communicated to the other copies so they can reflect the update too.
- A
- 12
When might a product deliberately tolerate a delay before replicas receive an update?
- A
When every read must immediately return the newest value everywhere
- B
When the product has no need to store data in more than one place
- C
When network messages are guaranteed to arrive in zero time
- D
When updates are infrequent and users can tolerate waiting for them to spread
Correct answer
DWhen updates are infrequent and users can tolerate waiting for them to spread
Explanation
The content describes manual or delayed propagation as a possible choice when updates are infrequent and users do not need an immediate change everywhere.
- A
- 13
What does the bank-statement example illustrate about updates to account records?
- A
A recorded change may take time to appear in a statement
- B
A bank avoids keeping a ledger when updates are infrequent
- C
A recorded change must be visible in every statement immediately
- D
A bank statement is stored only on the user's local device
Correct answer
AA recorded change may take time to appear in a statement
Explanation
The example describes account changes being recorded and spread through the system, with the possibility that they take days to appear on a bank statement.
- A
- 14
What role can TCP play when sending a replica update?
- A
It can guarantee that every server is available during the update
- B
It can provide reliable, ordered delivery of the update message
- C
It can replace the need for replicas to receive update messages
- D
It can decide which data value should be committed by the database
Correct answer
BIt can provide reliable, ordered delivery of the update message
Explanation
TCP is presented as a useful transport protocol because it provides reliable and ordered delivery, though distributed systems still need to handle failures and acknowledgements.
- A
- 15
Why is an acknowledgement useful after sending an update to another server?
- A
It allows the sender to avoid keeping track of the update
- B
It proves that all other replicas have already applied the update
- C
It guarantees that no server will fail during the transaction
- D
It gives the sender evidence that the receiver got the message
Correct answer
DIt gives the sender evidence that the receiver got the message
Explanation
Without an acknowledgement, the sender may not know whether the message reached the receiver, especially if the network or receiver fails.
- A
- 16
If an update's acknowledgement does not arrive, what response does the content describe?
- A
Assume the update succeeded and immediately discard the original data
- B
Treat the missing acknowledgement as proof that the receiver applied the update
- C
Retry the update, either for a chosen number of attempts or until it succeeds
- D
Stop all communication with the receiver permanently
Correct answer
CRetry the update, either for a chosen number of attempts or until it succeeds
Explanation
The sender can retry an update when no acknowledgement arrives. A system might retry indefinitely or stop after a fixed number of attempts.
- A
- 17
What fundamental uncertainty remains when one server commits locally and relies on a remote server's acknowledgement?
- A
The receiver is guaranteed to commit before receiving the update
- B
The receiver cannot determine whether it has a database
- C
The sender can prove that every network message arrived
- D
The sender cannot be certain that the acknowledgement will reach it
Correct answer
DThe sender cannot be certain that the acknowledgement will reach it
Explanation
Even if a receiver sends an acknowledgement, an unreliable network may prevent it from reaching the sender. The sender therefore cannot be certain of the remote outcome.
- A
- 18
Why does sending an acknowledgement of an acknowledgement fail to eliminate the coordination uncertainty described in the two-generals problem?
- A
The first acknowledgement automatically commits every replica
- B
The receiver is no longer able to tell whether it received the original update
- C
A second acknowledgement makes the network fully reliable
- D
The final acknowledgement can also be lost, creating the same uncertainty again
Correct answer
DThe final acknowledgement can also be lost, creating the same uncertainty again
Explanation
Any final confirmation message can also be lost. Adding another acknowledgement therefore repeats rather than eliminates the uncertainty about whether the message was received.
- A
- 19
What is the purpose of assigning one server the leader role in the described design?
- A
To remove the need to communicate changes to followers
- B
To prevent users from reading data from any server
- C
To ensure that followers can independently commit any update
- D
To make it the sole server that can write changes to the database
Correct answer
DTo make it the sole server that can write changes to the database
Explanation
In the leader-and-follower design, only the leader accepts writes. Followers receive updates from the leader and can serve reads.
- A
- 20
What consistency risk arises if a follower serves a read before receiving the leader's latest update?
- A
The follower is forced to make the same update independently
- B
The read may return an older value than the leader's copy
- C
The leader loses the ability to commit the update
- D
The read must return the newest value from every replica
Correct answer
BThe read may return an older value than the leader's copy
Explanation
If the follower has not received the update, it may return stale data, so its response can differ from the leader's copy.
- A
- 21
What tradeoff is described when a system waits for a follower's update before responding to a read?
- A
It makes the follower independent of the leader while preserving immediate availability
- B
It can avoid serving stale data, but the read may have to wait and become unavailable
- C
It avoids all network delays by removing the follower
- D
It makes the read faster while allowing it to return older data
Correct answer
BIt can avoid serving stale data, but the read may have to wait and become unavailable
Explanation
Waiting can prevent a read from seeing an outdated value, but the system may not respond while it waits for the update. The content presents this as a consistency-versus-availability tradeoff.
- A
- 22
In the described two-phase commit protocol, what does the leader do first after receiving an update?
- A
Send prepare requests to the followers
- B
Return a successful response without contacting followers
- C
Allow every follower to choose whether to write
- D
Tell the followers to roll back the transaction
Correct answer
ASend prepare requests to the followers
Explanation
The first phase is prepare: the leader asks followers to prepare the transaction and waits for their responses.
- A
- 23
What does a follower's acknowledgement of a prepare request indicate in the described protocol?
- A
It has already rolled back the transaction
- B
It has independently chosen a different update
- C
It is prepared and ready to commit the transaction
- D
It has permanently stopped accepting reads
Correct answer
CIt is prepared and ready to commit the transaction
Explanation
A prepare acknowledgement indicates that the follower has completed the preparation work and is ready to commit if instructed.
- A
- 24
What should the leader do if it does not receive all required prepare acknowledgements?
- A
Treat the transaction as failed and direct the system to roll it back
- B
Assume that every follower is prepared despite the missing responses
- C
Allow each follower to decide independently whether to commit
- D
Commit on every follower that did acknowledge and ignore the others
Correct answer
ATreat the transaction as failed and direct the system to roll it back
Explanation
A missing acknowledgement, a timeout, or a negative response can lead the leader to decide that the transaction cannot proceed and to roll it back.
- A
- 25
In a database transaction, what is the significance of the commit step after the transaction's statements have been prepared?
- A
It erases the transaction's statements before they can be applied
- B
It guarantees that no message can be lost in the network
- C
It makes the transaction's changes take effect for users of the database
- D
It tells the database to begin collecting statements
Correct answer
CIt makes the transaction's changes take effect for users of the database
Explanation
The transaction's statements can be written during preparation, but the commit tells the database to make the changes effective and visible.
- A
- 26
What does the prepare phase involve for a transaction containing multiple statements?
- A
Begin the transaction, record the required statements, and wait for the commit decision
- B
Send only the final statement and let each follower invent the rest
- C
Discard the statements and wait for users to repeat the update
- D
Commit each statement immediately and then ask whether the transaction should begin
Correct answer
ABegin the transaction, record the required statements, and wait for the commit decision
Explanation
The described prepare phase begins a transaction and records the statements needed for the update, but waits for the final decision before committing.
- A
- 27
Who directs followers to roll back in the described two-phase commit arrangement?
- A
Any user who attempts to read the data
- B
The leader, after deciding that the transaction failed
- C
Each follower, independently whenever its timer expires
- D
The network, automatically whenever a message is delayed
Correct answer
BThe leader, after deciding that the transaction failed
Explanation
The leader coordinates the transaction and tells followers to roll back when a negative response or timeout means the operation will not proceed.
- A
- 28
Why is a timeout alone not described as sufficient reason for a follower to independently roll back?
- A
A follower cannot store transaction information during preparation
- B
The follower must follow the leader's transaction decision to avoid conflicting outcomes
- C
A follower is the only system that can decide whether the leader received an update
- D
A timeout guarantees that the transaction has already committed everywhere
Correct answer
BThe follower must follow the leader's transaction decision to avoid conflicting outcomes
Explanation
The leader coordinates the transaction outcome. If followers independently roll back based only on their own timers, they could disagree about whether the transaction committed.
- A
- 29
If a follower commits a transaction but its acknowledgement is lost, what mechanism described in the content allows the leader to retry safely?
- A
A rule that makes the follower undo every successful commit
- B
A guarantee that acknowledgements cannot be lost
- C
A transaction ID that lets the follower recognize a repeated commit
- D
A new database for every retry
Correct answer
CA transaction ID that lets the follower recognize a repeated commit
Explanation
The transaction ID lets the follower recognize that a repeated commit request refers to the same transaction rather than a new operation.
- A
- 30
How does recognizing repeated requests by transaction ID help make a commit operation idempotent?
- A
Repeating the commit always creates a new transaction with a different result
- B
The transaction ID prevents the leader from receiving acknowledgements
- C
The follower automatically rolls back whenever it sees the same ID twice
- D
Repeating the same transaction's commit does not cause it to be applied as a different transaction
Correct answer
DRepeating the same transaction's commit does not cause it to be applied as a different transaction
Explanation
The same transaction ID allows a follower to recognize a retry as a duplicate request for the existing transaction, avoiding unintended repeated effects.
- A
- 31
Why can a failed commit message create inconsistent data if the leader has already committed locally?
- A
The follower must immediately delete its copy of the data
- B
The leader may show the new value while a follower still has the old value
- C
The leader is prevented from serving any reads
- D
All replicas automatically return the new value even without receiving it
Correct answer
BThe leader may show the new value while a follower still has the old value
Explanation
If the leader commits but a follower does not receive the commit, their copies can differ. A read from the follower could therefore return an older value.
- A
- 32
Why might a system lock a record while waiting for the commit outcome?
- A
To block reads and writes that could expose or create conflicting values
- B
To eliminate the need for commit messages
- C
To allow followers to commit without the leader
- D
To make every read return immediately from every follower
Correct answer
ATo block reads and writes that could expose or create conflicting values
Explanation
Locking prevents operations on the record while the outcome is uncertain, helping avoid reads or writes that would reveal inconsistent states.
- A
- 33
What is the availability cost of blocking reads on a locked record while waiting for a transaction to resolve?
- A
The system must create a second leader before processing reads
- B
Users may receive no response to a read while the record remains locked
- C
The database can no longer store any transaction statements
- D
Users are guaranteed to read a stale value immediately
Correct answer
BUsers may receive no response to a read while the record remains locked
Explanation
Blocking reads can preserve consistency, but requests may have to wait instead of receiving a response, reducing availability.
- A
- 34
Why might a financial system choose a strict consistency mechanism such as two-phase commit?
- A
It may prioritize consistent records over continued availability during failures
- B
It benefits from allowing each replica to choose its own result
- C
It needs to make every transaction complete without network communication
- D
It can avoid keeping track of whether transactions committed
Correct answer
AIt may prioritize consistent records over continued availability during failures
Explanation
The content presents strict consistency as potentially appropriate for financial systems, while noting that the tradeoff can be reduced availability.
- A
- 35
Besides reduced availability, what other costs of strict consistency are identified?
- A
More cache misses and the loss of all transaction records
- B
Less reliable delivery and the elimination of acknowledgements
- C
Fewer stored copies and guaranteed shorter network distances
- D
Lower performance and potentially higher physical system cost
Correct answer
DLower performance and potentially higher physical system cost
Explanation
The content notes that strong consistency can also affect performance and increase the physical cost of the system.
- A
- 36
What is the general idea of eventual consistency?
- A
Only one copy of data is allowed to exist at any time
- B
Every copy must match before any update can be accepted
- C
Copies may temporarily differ but are expected to become consistent over time
- D
A failed update is permanently ignored by every replica
Correct answer
CCopies may temporarily differ but are expected to become consistent over time
Explanation
Eventual consistency allows copies to differ temporarily while relying on updates eventually spreading so the copies converge.
- A

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