Google Professional Cloud Developer Question 180
Single answerGoogle Cloud PlatformYou are designing a distributed application on Google Cloud that uses Cloud Spanner as the database. The application requires that all users see the most up-to-date data immediately after a write operation, even in the presence of multiple concurrent transactions. Which consistency model should you use to meet this requirement?
- A
Strong consistency
- B
Eventual consistency
- C
Read-after-Write consistency
- D
Causal consistency
Show answer and explanation
Correct answer: A
Explanation
In the given scenario, the application requires that all users see the most up-to-date data immediately after a write operation. Strong consistency is the only model that guarantees this behavior, as it ensures that all reads reflect the latest data, even in a distributed system like Cloud Spanner. Other consistency models, such as eventual or causal consistency, may allow temporary inconsistencies, making them unsuitable for the scenario's requirements.
- A. Correct.
Strong consistency ensures that all reads reflect the most recent writes, which is required for scenarios where up-to-date data is mandatory, even with concurrent transactions.
- B. Incorrect.
Eventual consistency allows for temporary inconsistencies and may not reflect the latest data immediately, which makes it unsuitable for the requirement of always showing the most up-to-date data.
- C. Incorrect.
Read-after-Write consistency is not a consistency model provided by Google Cloud Spanner. It is a different concept and not relevant to this question.
- D. Incorrect.
Causal consistency ensures that operations are seen in a causally consistent order, but it does not guarantee that all reads reflect the most recent writes, making it unsuitable for the scenario.