Thanks again for joining me for another post in the series of #100daysofAWS. Today, on Day 3 I will be talking all about an extremely powerful database service known as DynamoDB.
DynamoDB is Amazon Web Services’ No-SQL, Key-Value Database. It’s ability to scale on demand, and it’s ability to deliver single-digit millisecond performance at any scale can be a powerful asset for a myriad of different applications.
Let’s start by discussing what is meant by a ‘No SQL’ Database. In order to understand this, let’s briefly discuss what is meant by SQL.
SQL — or Structured Query Language is a long-standing domain-specific language which is used to interact with Relational Databases. SQL is a very valuable tool to use when you are interacting with Relational databases, as it allows your to create complex queries of large homogeneous data sets, and easily extract large amounts of data, and use it in whichever way you see fit.
The downside of relational databases however is when it comes to scaling. As Relational databases scale up and grow, reads per second becomes considerable slower. This can obviously have a massive effect of the user experience. Whist there are numerous ways to ameliorate this problem if your use case revolves around storing structured, ordered data sets, in certain cases using a Key-Value (or No SQL / Non-Relational) database can provide a tremendous performance improvement at any scale for the end user.
This leads to the introduction of my favourite Non-relational Database, DynamoDB.
DynamoDb is not only a multi-region, fully managed, durable database service with built in security, in-memory caching and the ability to backup and restore data, but it is able to handle up to 20 Million concurrent requests per second! This is clearly an amazing feat and can provide a lot of value to a lot of organisations, and a lot of different use cases.
The first thing to highlight is that DynamoDB is fully managed and serverless, which has a massive advantage compared to traditional databases due to it’s ability to free up any developers, architects from configuring minor details, and allow them to focus on the immediate business need.
The basic structure of a DynamoDB table uses Items (rows) which consist of Attributes (Columns). DynamoDB uses primary keys as a way to uniquely identify each item in a table, and secondary indexes to provide more querying flexibility depending on your need.
Your table can also split up your tables into partitions of data, which can massively increase your speed of reads/writes for very large tables. This is actually also done automatically when you exceed 10GB of data, 3000 RCUs (Read Capacity Unit) per single partition or 1000 WCUs (Write Capacity Units) per single partition, giving your one less thing to worry about.
DynamoDB can be configured in one of two modes:
- Provisioned Capacity Mode — DynamoDB Scales up and down to support whichever read/write capacity you desire.
- On-Demand — There is little to know capacity planning, and DynamoDB scales automatically, however this costs more.
There is also the ability to provision your DynamoDB table using Eventually Consistent Read and Strongly Consistent Reads, depending on how up-to-date your data needs to be.
Eventually Consistent Reads are when data is being returned immediately, but it may not be inconsistent (this normally takes up to 1 second).
Strongly Consistent Reads will always be entirely consistent, but the latency will likely be higher. There is no better option to choose from per-say, as it entirely depends on your use case.
Another positive attribute of using DynamoDb is the durability of your files which comes as a standard. AWS stores 3 copies of your data on SSD across 3 Availability Zones! This can allow your data to be very secure when deciding to store it in DynamoDB.
DynamoDB Global Tables
DynamoDB uses the global nature of AWS to replicate your tables across regions of your choosing in order to deliver fast, local, read and write performance to allow you to build massively scaled, global applications.
Global tables simply remove the need to manually replicate your data across multiple regions and also protect against the rare possibility of a region going out service, giving you an incredibly amount of protection and disaster recovery.
The last area of DynamoDB I want to cover before we get into some use cases is something called Dynamo DB Accelatator, otherwise known as Dynamo DAX.
Dynamo DAX is DynamoDB’s caching solution. It is an in-memory cache which can deliver a performance benefit of up to 10x greater than standard DynamoDB, as though it wasn’t performant enough!
Because it is fully-managed, it doesn’t take teams of developers to organise the cache invalidation, data population, or cluster management. AWS does all the heavy lifting for you!
Use Cases for Dynamo DB
The structure of some forms of data is much more efficiently dealt with using NoSQL. The Key-Value nature of DynamoDB allows you to store and manage structured, semi-structured, and unstructured data in one database.
This flexibility and ability to scale can be used for many more applications that can be stated here. The key is DynamoDB’s ability to scale and grow at an unprecedented rate.
That was my brief introduction to DynamoDB. Please join me tomorrow where I am going to talk all about IAM.
Thanks for reading, have a great day and Happy Building,