Explore core trade-offs between consistency and availability in distributed systems with scenario-based questions. This quiz helps clarify fundamental concepts in distributed database design, CAP theorem, and real-world system behavior during network issues.
In a distributed system, if a network partition occurs and the system chooses to remain available, what is most likely to be affected?
Explanation: When prioritizing availability during a network partition, consistency may suffer because nodes may accept operations independently. Efficiency and scalability are not directly affected by the partition in this context, while redundancy relates to data copies rather than the CAP trade-off. Thus, consistency is the aspect most compromised in this scenario.
If a distributed database offers eventual consistency, what does this mean for read operations immediately after a write?
Explanation: Eventual consistency allows the system to remain available, but some reads after a write may return outdated data until all replicas are updated. Always consistent reads are not guaranteed under eventual consistency. Reads do not always fail, and the system is designed so reads can eventually succeed, not never succeed.
A financial transaction system is designed to never allow any two users to see different account balances at the same time, even if this means turning away requests during server issues. What is being prioritized?
Explanation: Prioritizing always correct and up-to-date data reflects consistency, especially when some requests may be denied in favor of data accuracy. Availability is not prioritized since requests can be rejected. Latency refers to speed, and partitioning is a technique, not an objective here.
Which system is most likely prioritizing availability over consistency: one that always responds to queries even during server failure, or one that delays responses until it verifies data accuracy?
Explanation: Responding to queries in spite of failures shows the system values availability, possibly at the expense of returning accurate data. The system that delays responses is ensuring consistency but reducing availability. Both cannot prioritize consistency at the same time, and the last option is incorrect as at least one does prioritize availability.
According to the CAP theorem, in the presence of a network partition, which two properties can be maximized at the same time?
Explanation: CAP theorem states that when a partition happens, a distributed system must choose between consistency and availability; it cannot guarantee both. Consistency and partition tolerance can be combined by sacrificing availability, but not all three together. Latency and scalability are not part of the CAP theorem.
A user updates a document and expects to see their change immediately on the next page load. Which consistency model does this scenario describe?
Explanation: Read-your-writes ensures users always see their own updates instantly. Eventual consistency may show delays before changes appear. Availability-first is not a standard consistency model. Staggered sync is not a well-defined model in this context.
A chat application wants messages to always be delivered even if some users see them with a delay. Which is being prioritized?
Explanation: Ensuring messages are always delivered is a sign that availability is prioritized, even though some users may experience delays or see messages in a different order. Consistency would require all users to see the same message at the same time, not delays. Transactionality and isolation refer to properties of transactions, not message delivery.
What can happen to data in a distributed system that prioritizes availability during a network partition?
Explanation: By keeping the system available during partitions, conflicting versions can occur because updates may be accepted without coordination. Data is not guaranteed to be synchronized. Writes are not blocked, which is why conflicts happen. The system does not shut down if it prioritizes availability.
Which application is most likely to require strong consistency over high availability: online banking or a news website?
Explanation: Online banking deals with critical financial data where correctness is essential, requiring strong consistency. News websites, e-commerce homepages, and comment sections can tolerate some inconsistency for better availability without major consequences.
When designing a distributed key-value store to ensure it is always available, what essential trade-off must be accepted according to CAP theorem?
Explanation: To keep the system always available, it must accept possible data inconsistency, especially during network partitions. Slower responses or reduced storage aren't required by CAP trade-offs. Higher costs may occur in practice, but inconsistency is the specific theoretical compromise.