NotesSystem

DynamoDB

Also: Amazon DynamoDB

AWS's managed key-value and document database (2012). Tables are hash-partitioned by a partition key into partitions with hard per-partition throughput limits, which the service splits and moves automatically. Despite the name, it shares little of [[Dynamo]]'s architecture.

Also in: Sharding › In the real world · Distributed Transactions › In the real world

Design choices

  • Hash Partitioning: the partition key is hashed to pick a partition; items sharing a partition key form an item collection sorted by the sort key.
  • Per-partition limits: each partition is designed for 3,000 read units and 1,000 write units per second, so a Hot Spot throttles even when the table has spare capacity.
  • Rebalancing: partitions split for size and for consumed throughput, at a split point chosen from observed key distribution; single-item or sequential hot spots aren't split.
  • Leader-Based Replication: each partition has three replicas in different Availability Zones; a Multi-Paxos group elects a leader that takes writes and strongly consistent reads.
  • Request Routing: a request-router fleet looks up partition locations in MemDS, an in-memory metadata store.
  • Local vs Global Secondary Index: GSIs are separately partitioned and eventually consistent; LSIs share the base partition key and allow strong reads.
  • Transactions: TransactWriteItems groups up to 100 actions atomically within one Region, at two underlying writes per item (prepare and commit).

Notable trade-offs

  • Access patterns must be designed up front around the partition key; ad-hoc queries become scans.
  • Global tables replicate asynchronously; transactions are ACID only in the Region where they ran.
  • Scale is the payoff: during Prime Day 2021, Amazon's systems peaked at 89.2 million requests per second against it.