Explore the key differences between strong consistency and eventual consistency in distributed systems with this quiz designed to clarify how data accuracy and timing work across various scenarios. Sharpen your understanding of these consistency models and learn which situations best suit each approach.
Which of the following best describes strong consistency in a distributed system?
Explanation: Strong consistency ensures that every user accessing the system will always see the most recent version of the data, no matter which server they connect to. The other options are incorrect because updating data once per hour (option B) does not guarantee immediate visibility, eventual consistency (option C) allows for temporary stale reads, and random synchronization (option D) does not guarantee any predictable consistency.
If a system uses eventual consistency, what might a user experience right after updating their profile picture?
Explanation: Eventual consistency means changes like an updated profile picture may not be instantly visible to everyone, so some users might briefly see outdated data. Option B is incorrect because instant consistency is not guaranteed. Option C is not a characteristic of eventual consistency. Option D describes data loss, which is unrelated.
Why might a distributed system choose eventual consistency over strong consistency?
Explanation: Eventual consistency helps systems provide faster responses and remain available during network partitions, which is ideal for applications where absolute up-to-the-second accuracy is not essential. Strong consistency (option B) provides accuracy but at the cost of possible latency. Options C and D are incorrect as eventual consistency does not block updates or intentionally cause failures.
A user adds an item to a shopping cart on one server. In a strongly consistent system, what happens when they view the cart from another device immediately afterward?
Explanation: Strong consistency ensures any changes like adding an item to a cart are immediately visible across all devices and servers. Option B is incorrect as strong consistency never causes data loss. Option C does not reflect consistency guarantees, and option D discusses user sessions, which is unrelated.
For which application is eventual consistency most appropriate?
Explanation: Social media feeds can tolerate slight delays in updates, making eventual consistency suitable. Bank transfers (option B), authentication (option C), and medical monitoring (option D) require strong guarantees and up-to-date data, where delays or temporary inconsistencies could cause problems.
In eventual consistency, what is often used to handle conflicting updates from multiple sources?
Explanation: Eventual consistency often relies on conflict resolution strategies like last-write-wins to manage updates that occur simultaneously. Immediate global locking (option B) is costly and not common in these systems. Option C is impractical, and option D would prevent eventual consistency from functioning.
Which consistency model guarantees that once a user writes data, their subsequent reads always reflect that write?
Explanation: Strong consistency ensures a 'read your writes' guarantee, meaning users always see their own updates immediately. Eventual consistency (option B) could show outdated data. Options C and D are not valid or recognized consistency models.
During a network partition, which consistency model typically prioritizes availability over immediate accuracy?
Explanation: Eventual consistency allows the system to remain available even during network disruptions, with the guarantee that all nodes will eventually synchronize. Strong consistency (option B) may sacrifice availability for accuracy. Sequential and backward consistency (options C and D) are not commonly discussed partition strategies.
Why is strong consistency generally required for banking transactions?
Explanation: Banking requires absolute accuracy and integrity, which strong consistency provides, preventing issues like double spending. Slight mismatches (option B), outdated values (option C), and duplication (option D) are risky and unacceptable in financial applications.
What is a primary reason large-scale distributed systems often choose eventual consistency?
Explanation: Eventual consistency allows systems to scale easily and continue operating smoothly despite network failures. Eliminating synchronization (option B) would result in data chaos, while option C refers to strong consistency. Reducing servers (option D) is unrelated to consistency models.