Data Consistency in Distributed Systems
- 44Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
In a distributed data system, what is the general meaning of consistency?
When data has multiple copies, the copies should contain the same information.
Or swipe the card
44 cards
In a distributed data system, what is the general meaning of consistency?
When data has multiple copies, the copies should contain the same information.
What does the C stand for in the CAP theorem and in the consistency property of database transactions?
Consistency.
In the single-copy profile example, how does a server handle a request to retrieve a profile?
It looks up the profile in its database and returns it to the requester.
Why can a single server be called a single point of failure?
If that server fails or becomes unavailable, the entire system can go down and its data may be inaccessible.
What is vertical scaling, and what are its main limitations?
Vertical scaling increases the capacity of one server. It can become very expensive and eventually reaches a limit.
Why can a centralized server create high latency for users in distant regions?
Requests must travel over a long network path to reach the server, increasing response time.
What three problems of a single-server design are highlighted in the example?
A single point of failure, limits and costs of vertical scaling, and high latency for geographically distant users.
What is the limitation of placing separate, unconnected servers in different regions?
Users can access data local to their region, but the regions cannot share data with one another.
If a user in one region directly requests data stored only in another region, what problems can remain?
The request may have high latency, and the remote server can still be a single point of failure for that data.
How does caching data from a remote region help reduce latency?
A local server stores a copy of requested remote data and can answer later requests locally.
What is a cache miss in the regional profile example?
A requested profile is not in the local cache, so the local server must fetch it from the remote server.
Why does caching reduce latency without eliminating it?
Cache misses still require remote requests, and cached data may be removed through cache replacement.
How can replicating data across regions improve resilience?
If one server fails, another server holding a copy can still provide the data.
How can geographically distributed replicas reduce latency?
Users can read a nearby copy of the data instead of contacting a distant server.
What consistency problem arises when a replicated record is updated in one region?
Other replicas may still contain the old value until the update reaches them.
In the example, what must happen after one replica changes a value from C to C++?
The update must be propagated to the other replicas so they also store C++.
What is one simple way to synchronize replicas when updates are very infrequent?
Apply or spread the updates manually, accepting that copies may remain different for a while.
How does the bank-ledger example illustrate delayed consistency?
Account changes can be recorded first and reflected in a bank statement later, potentially after a delay of days.
Why is delayed manual synchronization unsuitable for a real-time service such as a social network?
Users expect changes to propagate quickly, so waiting a long time for copies to match is unacceptable.
What useful properties of TCP motivate using it to send replica updates?
Reliable delivery and ordered delivery.
Why is sending an update message alone not enough to know that a replica has been updated?
The message may fail to arrive, or the receiving server may be down; without an acknowledgment, the sender cannot know whether the update succeeded.
What does an acknowledgment from a receiving server tell the update sender?
That the receiver got the update and, in the described process, the update went through.
What can a sender do if it does not receive an acknowledgment for an update?
Retry sending the update, either repeatedly until success or for a limited number of attempts before giving up.
What is the core uncertainty behind the Two Generals problem as described in the content?
Over an unreliable network, parties cannot be certain that a message or its acknowledgment was received, even if they send further acknowledgments.
Why does making a local update before receiving confirmation from a peer create a consistency risk?
The local server may commit the update while the peer never receives or commits it, leaving the copies different.
What is the basic leader-follower arrangement described for simplifying replicated writes?
Only the leader accepts writes; followers receive updates from the leader and can serve reads.
Why can a read from a follower return stale data in a leader-follower system?
The follower may not yet have received or applied the leader's latest update.
What is the first phase of two-phase commit?
The prepare phase: the leader asks participants to prepare the transaction and wait for the final decision.
What does a participant communicate when it acknowledges a prepare request?
That it has completed the preparation work and is ready to commit.
What happens to a database transaction during preparation, before commit?
The system begins a transaction and performs or records the required statements, but does not yet make the changes final for readers.
What is the second phase of two-phase commit when all participants are ready?
The leader sends a commit message, and participants commit the prepared transaction.
What should the leader do if a participant rejects preparation or fails to acknowledge before a timeout?
Abort the transaction and direct participants to roll it back.
Why should a prepared participant not independently roll back just because a timer expires?
It must wait for the leader's decision; an independent rollback could conflict with a commit decision made elsewhere.
How does rollback restore the original data in the example?
The transaction's change, such as C to C++, is undone so the value returns to C.
What is the result when the leader commits and all followers receive and commit the transaction?
The replicas reflect the updated value, so later reads return the new data.
Why can a failed commit message create inconsistent reads in a replicated system?
The leader may show the new value while a follower that missed the commit still has the old value.
How can a system prevent reads and writes from exposing partially committed data?
It can lock the affected data and block those operations until the commit process is resolved.
Why might a follower receive the same commit message more than once?
The follower may commit successfully but its acknowledgment may fail to reach the leader, causing the leader to retry.
How can a transaction ID help make commit retries safe?
It lets the system recognize repeated commit messages for the same transaction and handle them without applying the transaction again as a new one.
Why can strict two-phase commit reduce system availability?
Operations may be blocked while the system waits for acknowledgments or for the leader to resolve the transaction.
What is the consistency-versus-availability tradeoff illustrated by blocking reads?
Blocking reads can prevent users from seeing inconsistent data, but users may receive no response while the system waits.
Besides availability, what other costs can strict consistency impose?
Reduced performance and, in some cases, increased physical system cost.
For what kind of application does the content suggest strict consistency may be worthwhile?
A financial system where having all copies agree is especially important.
What alternative to requiring immediate agreement across all copies does the content introduce?
Eventual consistency.

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