Strong vs. Eventual Consistency Flashcards
(9 cards)
What does consistency mean within a distributed system?
Consistency refers to the property that all copies of data (across all servers or nodes) reflect the same state.
What are the two most common data consistency models?
Strong consistency and eventual consistency
What is Strong Consistency?
Strong consistency guarantees that all reads of data will return the most recent write after completed.
How is Strong Consistency typically achieved?
It’s achieved through the use of synchronous replication, meaning that the data will be written and acknowledged to all nodes (or a majority in a quorum configuration) before being considered successful.
What is a challenge introduced by the strong consistency model?
Strong consistency and its use of synchronous replication can introduce latency, typically via blocking, while waiting for the operations to be confirmed by all replicas.
What’s a classical example to use to demonstrate an appropriate case for strong consistency?
Banking or financial transactions as it’s critical that after any monies that may be spent are immediately reflected in the balance to prevent overspending.
What databases support strong consistency? What’s an example of a cloud offering that does so?
Most traditional databases and many modern ones support it. Google Spanner would be an example that is distributed but still provides strong consistency.
What are the two most common downsides of strong consistency? Explain each.
Latency and availability.
Latency is introduced via the nature of synchronous replication as every node/replica will have to confirm the operations. Since some systems may be widely distributed, there can be network latency involved.
In the same vein, availability can be compromised if any of the required nodes is experiencing issues and is unable to confirm an operation as the system would fail as opposed to compromising consistency.
What are the trade-offs of strong consistency and when you would choose it as a model?
Strong consistency sacrifices performance and potentially availability for the sake of accuracy. Said differently, absolute correctness at the cost of response times (and potentially availability during failures).
When correctness is absolutely critical, that’s when you should choose strong consistency.