Google Professional Cloud Developer Question 176
Single answerGoogle Cloud PlatformYou are developing a cloud-based e-commerce application on Google Cloud. The application uses a global database to store inventory data. It is critical that any user, regardless of location, always sees the exact and most up-to-date inventory count immediately after an update. Which consistency model should you choose for the database to satisfy this requirement?
- A
Eventual consistency
- B
Strong consistency
- C
Causal consistency
- D
Read-after-write consistency
Show answer and explanation
Correct answer: B
Explanation
Strong consistency is the only model that guarantees all users, regardless of their location, will see the most recent data immediately after an update. This is critical for use cases like inventory management in an e-commerce application where any discrepancy could lead to negative customer experience or overselling of products. Eventual, causal, and read-after-write consistency models do not provide this guarantee.
- A. Incorrect.
Eventual consistency allows updates to propagate over time, which means users might see stale data temporarily. This does not meet the requirement for users to always see the most up-to-date data immediately.
- B. Correct.
Strong consistency ensures that all users, regardless of location, see the most recent data immediately after an update. This satisfies the requirement for always up-to-date inventory data.
- C. Incorrect.
Causal consistency ensures that related updates are seen in the correct order but does not guarantee immediate consistency across all locations. This does not fully meet the requirement for up-to-date data.
- D. Incorrect.
Read-after-write consistency ensures a user can immediately read their own writes, but it does not guarantee that other users in different locations will see the most recent data immediately. This does not meet the requirement for global consistency.