Dynamodb medium
In a Global Tables configuration (Multi-Region), how does DynamoDB resolve a scenario where the same attribute is updated in both US-East and EU-West within the same millisecond?
- A Global Locking: The first region to start the write locks the item globally until it is replicated to all regions.
- B Last-Writer-Wins (LWW): It uses the timestamp of the write request to decide the winner; if timestamps are equal, a deterministic tie-breaker (like region name) is used.
- C Hybrid Merge: It attempts to combine both JSON documents into a single version.
- D Manual Resolution: Both versions are saved, and the application must resolve them manually (similar to Git).
Answer: B. Last-Writer-Wins (LWW): It uses the timestamp of the write request to decide the winner; if timestamps are equal, a deterministic tie-breaker (like region name) is used.
Global Tables prioritize availability over strict consistency (Eventual Consistency across regions). The system uses LWW to ensure that eventually, every region converges on the 'latest' state, even if intermediate states differed. This assumes system clocks are relatively synchronized via NTP.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- DynamoDB has a strict 400KB limit on the size of a single item. What is the recommended design pattern if you need to store larger documents (e.g., 5MB PDFs)?
- What is the primary role of the 'Partition Key' in ensuring DynamoDB's infinite horizontal scalability?
- Why is the `Query` operation generally preferred over `Scan` for production workloads in DynamoDB?
- DynamoDB is a 'fully managed' serverless database. What is a primary operational benefit of this model for an engineering team?
- In 'Provisioned Capacity' mode, how is the performance budget of a DynamoDB table defined?
- When would an architect choose to implement DAX (DynamoDB Accelerator) in front of an existing DynamoDB table?