Home » AWS DynamoDB

What is DynamoDB?

  • Amazon DynamoDB is a fast and flexible NoSQL database service for all applications that require consistent single-digit millisecond latency at any scale.
  • It is a fully managed database that supports both document and key-value data models.
  • Its flexible data model and performance makes it a great fit for mobile, web, gaming, ad-tech, IOT, and many other applications.
  • It is stored in SSD storage.
  • It is spread across three geographically data centres.

DynamoDB

Because of its availability in three geographically data centres, It consists of two different types of consistency models:

  • Eventual Consistent Reads
  • Strongly Consistent Reads

Eventual Consistent Reads

It maintains consistency across all the copies of data which is usually reached within a second. If you read a data from DynamoDB table, then the response would not reflect the most recently completed write operation, and if you repeat to read the data after a short period, then the response would be the lattest update. This is the best model for Read performance.

Strongly Consistent Reads

A strongly consistent read returns a result that reflects all writes that received a successful response prior to the read.

Note: If your application wants the data from DynamoDB table immediately, then choose the Strongly Consistent Read model. If you can wait for a second, then choose the Eventual Consistent Model.

AWS DynamoDB Throughput Capacity

DynamoDB throughput capacity depends on the read/write capacity modes for performing read/write operation on tables.

DynamoDB

There are two types of read/write capacity modes:

  • Provisioned mode
  • On-demand mode

Provisioned mode

  • It defines the maximum amount of capacity that an application can use from a specified table.
  • In a provisioned mode, you need to specify the number of reads and writes per second required by the application.
  • If the limit of Provisioned mode throughput capacity is exceeded, then this leads to the request throttling.
  • A provisioned mode is good for applications that have predictable and consistent traffic.

DynamoDB

The Provisioned mode consists of two capacity units:

  • Read Capacity unit
  • Write Capacity unit

Read Capacity Unit

  • The total number of read capacity units depends on the item size, and read consistency model.
  • Read Capacity unit represents two types of consistency models:
    • Strongly Consistent model: Read Capacity Unit represents one strong consistent read per second for an item up to 4KB in size.
    • Eventually Consistent model: Read Capacity Unit represents two eventually consistent reads per second for an item up to 4KB in size.
  • DynamoDB will require additional read capacity units when an item size is greater than 4KB. For example, if the size of an item is 8KB, 2 read capacity units are required for strongly consistent read while 1 read capacity unit is required for eventually consistent read.

Write Capacity Unit

  • The total number of write capacity unit depends on the item size.
  • Only 1 write capacity unit is required for an item up to size 1KB.
  • DynamoDB will require additional write capacity units when size is greater than 1KB. For example, if an item size is 2KB, two write capacity units are required to perform 1 write per second.
  • For example, if you create a table with 20 write capacity units, then you can perform 20 writes per second for an item up to 1KB in size.

On-Demand mode

  • DynamoDB on-demand mode has a flexible new billing option which is capable of serving thousands of requests per second without any capacity planning.
  • On-Demand mode offers pay-per-request pricing for read and write requests so that you need to pay only for what you use, thus, making it easy to balance costs and performance.
  • In On-Demand mode, DynamoDb accommodates the customer’s workload instantly as the traffic level increases or decreases.
  • On-Demand mode supports all the DynamoDB features such as encryption, point-in-time recovery, etc except auto-scaling
  • If you do not perform any read/write, then you just need to pay for data storage only.
  • On-Demand mode is useful for those applications that have unpredictable traffic and database is very complex to forecast.

Next TopicAWS Aurora

You may also like