Site Logo
Published on

Why is DynamoDB AWSome?

Authors

What is DynamoDB?

DynamoDB is a cloud NoSQL database service that guarantees consistent performance at any scale. Consistent performance, durability, and high availability are key requirements for many mission-critical use cases. DynamoDB is also hassle-free because it's fully managed and serverless.

How is DynamoDB able to provide such amazing performance?

  • It has a fairly simple and straightforward data model.
  • A key-value model that is simple to understand; many use cases can be modeled as a key-value.
  • Each DynamoDB table is partitioned, meaning each partition can be stored on a separate machine.
  • As a table is partitioned, it can grow to any size and serve any read-write throughput. This model is purely horizontally scalable.
  • What's the deal with consistent performance?
    • Each partition can grow up to a predefined maximum size (10GB). When a partition grows beyond that size, a new partition is created.
    • The old partition never gets a performance hit. Its performance is always bounded (to a few milliseconds, which is absolutely insane).
    • Now that each table is partitioned, each partition is replicated across multiple machines that form a replica group. Each replica in a group is stored in separate Availability Zones (AZs) to support high availability.
    • This means if any replica goes down, there are still other replicas that can serve read-writes.

A little more on the table structure

  • Each table is a collection of items.
  • Each item has a primary key and a set of properties.
  • The primary key uniquely identifies every item in the table.
  • The primary key is a simple key which contains a partitionKey, or a composite key which is a combination of partitionKey and sortKey.
  • The sort key is optional, but it identifies how the key-value pairs will be sorted on a partition that is identified by the partition key.
  • The primary key is hashed using a hashing function, and this hash value identifies the partition where the data is stored.
  • So, for any item, a read or a write path quickly knows which partition to go to.
  • Since the read-write path always has a fixed number of hops and each partition has a maximum size, operation latency is bounded and hence predictable.

Advanced Features

  • ACID Transactions: DynamoDB supports ACID transactions, enabling applications to update one or multiple items while ensuring atomicity, consistency, isolation, and durability across items without compromising scalability, availability, and performance. This is a big win for applications that fit this model and need ACID guarantees.
  • Change Data Capture (CDC): DynamoDB provides a stream of events that can be consumed to be aware of the changes happening to your table. This is a time-ordered flow of information on the changes done to the items in your DynamoDB table. Each record exists exactly once in the stream, and the order of the records in the stream is exactly the same as how it happened. For an in-depth understanding, refer to the DynamoDB masterclass for detailed insights into its scalability and performance.