Amazon DynamoDB introduction : The Key to Effortless Scalability and High Performance

Amazon DynamoDB introduction: The Key to Effortless Scalability and High Performance

In this article you will learn about DynamoDB’s features, throughput, cost, usage cases, and limitations.

amazon-dynamodb

What is Dynamo DB?

DynamoDB is a NoSQL database offered by Amazon Web Services (AWS). For companies that need effective data management solutions, it is made to offer great performance, and scalability. Unlike conventional relational databases, DynamoDB uses a non-relational data paradigm, enabling more adaptable and scalable data storage.

Organizations need high-performance, scalable, and trustworthy data solutions, DynamoDB can be a good alternative, whether they are beginning a new project or updating an old database.

Like other database systems, Amazon DynamoDB stores the data in tables. A table is a collection of items, and each item is a collection of attributes. DynamoDB uses the concept of primary keys to uniquely identify each item in a table. Amazon DynamoDB allows you to create one or more secondary indexes on a table that lets you query the data in the table using an alternate key.

For example, Table called Customer contains the 2 items and attributes:

Customer 
{ 
    "CustomerID": 1001, 
    "FirstName": "John", 
	"LastName": "Wick", 
    "Contact": { 
                "Mobile": "+111-111111", 
                "Landline": "111-111111" 
    } 
} 
{ 
    "CustomerID": 1002, 
    "FirstName": "Tom", 
	"LastName": "", 
    "Contact": { 
                "Mobile": "+222-222222", 
                "Landline": "222-222222" 
    } 
} 

Features of DynamoDB

  • Scalability: As your data grows, DynamoDB is built to scale seamlessly. The flexible data modeling it supports and its ease of handling millions of queries per second.
  • High performance: DynamoDB is made for fast throughput and lower latency.
  • Flexible data modeling: DynamoDB, as opposed to relational databases, enables flexible, non-relational data storage. Complex data interactions are now simpler to understand and manage as a result.
  • Managed service: DynamoDB is a fully managed service, AWS will take care of the underlying hardware and infrastructure on your behalf. This eliminates the need for human administration and makes it simple to set up and utilize.

DynamoDB Throughput and Cost

DynamoDB’s throughput capacity is determined by the read and write capacity modes for its tables. You can set the read/write capacity mode when creating a table or you can change it later. DynamoDB charges for reading, writing, and storing data in your DynamoDB table.

There are two Read/Write capacity modes:

  • On-demand
  • Provisioned (default, free-tier eligible)

On-demand

On-demand mode in DynamoDB is a capacity setting that allows you to serve thousands of read and write requests per second without having to manage the underlying capacity. With this mode, you pay only for the number of read and write requests you make, with no upfront costs or capacity planning required. This mode is suitable for applications with unpredictable or rapidly changing traffic patterns.

On-demand mode is a good choice if
  • You don’t know how much traffic they’ll get.
  • Your application’s traffic is unpredictable.
  • You prefer to pay only for what you use, without having to plan ahead.
Read request units and write request units
Read request example

In DynamoDB, there are 3 ways to read data: strong consistency, eventual consistency, and transactional.
Here’s how each type affects the amount of read request units you’ll need:

  • Strong consistency : Reading an item (up to 4 KB) with strong consistency requires 1 read request unit.
  • Eventual consistency : Reading an item (up to 4 KB) with eventual consistency requires one-half read request unit.
  • Transactional : Reading an item (up to 4 KB) in a transaction requires 2 read request units.

Read request unit example:
If Item Size == 8 KB , then total number of read request unit required :

  • 2 read request units for one strongly consistent read.
  • 1 read request unit for eventually consistent read.
  • 4 read request units for a transactional read.
Write request example
  • 1 write request unit represents one write for an item up to 1 KB.
  • Transactional write requests require 2 write request units to perform one write for items up to 1 KB.

Write request unit example:
If, Item Size == 2KB , then total number of write request unit required :

  • 2 write request units to sustain one write request
  • 4 write request units for a transactional write request.

Check here, Pricing for On-Demand Capacity .

Provisioned

Provisioned mode in DynamoDB is a capacity setting that allows you to set a maximum limit on the number of read and write operations per second that your application can consume from a table or index. In this manner, you choose the read and write capacity configuration and pay for it whether you use it or not.

Provisioned mode is a good choice if
  • Your application’s traffic is predictable.
  • Your traffic stays consistent or slowly increases over time.
  • You’re able to estimate how much capacity you’ll need to control costs.
Read capacity units (RCUs) and write capacity units (WCUs)
Read capacity units (RCUs) example
  • Strong consistency : Reading an item (up to 4 KB) with strong consistency requires 1 read per second.
  • Eventual consistency : Reading an item (up to 4 KB) with eventual consistency requires 2 reads per second.
  • Transactional: Reading an item (up to 4 KB) in a transaction requires 2 reads capacity unit to perform 1 read per second.

Read capacity unit example:
If, Item Size == 8 KB , then total number of read capacity units required

  • 2 read capacity units for strongly consistent read.
  • 1 read capacity unit for eventually consistent read.
  • 4 read capacity units for a transactional read.
Write capacity units (WCUs)
  • 1 write capacity unit represents one write per second for an item up to 1 KB.
  • Transactional write requests require 2 write capacity units to perform one write per second for items up to 1 KB.

DynamoDB Use Cases

  • Mobile and web applications: DynamoDB is a popular choice for building mobile and web applications that require fast, flexible data storage and retrieval.
  • Gaming: DynamoDB can handle the high volume and low latency requirements of gaming applications.
  • Internet of Things (IoT): DynamoDB is well-suited for storing and managing large amounts of IoT data, as it can easily scale to handle the high volume of incoming data.
  • Ad tech: DynamoDB’s fast performance and flexible data modeling make it a good choice for ad tech companies that need to store and retrieve data quickly.

Limitations of DynamoDB

  • Cost: DynamoDB can be expensive if you have a high volume of read and write requests. It’s important to carefully consider your data needs and usage patterns to determine whether DynamoDB is the right choice for your business.
  • Complexity: Although DynamoDB is a managed service, it can still be complex to use, especially for those who are new to NoSQL databases.
  • Lack of SQL support: DynamoDB does not support SQL, so it may not be the best choice for businesses that are used to working with relational databases and are familiar with SQL queries.
  • Eventual Consistency: DynamoDB uses eventual consistency, which means that updates made to the database may not be immediately visible. This can be an issue for businesses that require immediate data consistency.

Conclusion

DynamoDB is a high-performance, scalable, and reliable NoSQL database provided by AWS. Its flexible data modeling and managed service make it a popular choice for building mobile and web applications, gaming, IoT, and ad tech. However, its cost and complexity should be considered before choosing DynamoDB as your data solution.

Amazon DynamoDB introduction : The Key to Effortless Scalability and High Performance
Scroll to top