Serverless in nature, there’s no infrastructure provisioning needed.
DynamoDB is a fully managed, Internet scalable, easily administrated and cost-effective NoSQL database.
DynamoDB offers built-in security, continuous backups, automated multi-Region replication, in-memory caching, and data export tools.
Data is organized in tables, which contains items. Each item contains a set of key-value pairs of attributes. There are two special types of attributes: the primary-key, which works similarly to an item ID, and the sort-key, which allows for ordering the items.
Dynamo supports secondary indexes. They can be used to reference and order items by different primary-key and sort-keys. It is a schema-less database, in which items can have different sets of attributes. This allows for sparse indexes: composed only of items that contain a particular attribute.
DynamoDB can handle more than 10 trillion requests per day and can support peaks of more than 20 million requests per second.
Main Concepts of DynamoDB
DynamoDB supports different data types for attributes of an item, they can be mainly categorised into the following:
Scalar Types : Number, String, Binary, Boolean and Null.
Document Types : List and Map
Set Types : Number Set, String Set, and Binary Set.
Table: as a collection that can hold a virtually infinite number of items, it may also have secondary indexes associated
Secondary Index: duplicates table items using a different primary-key and sort-key
Item: the most basic unit in Dynamo, it holds the data attributes structured in a JSON
Attribute: a key value pair that contains informational data-points about an item in the database table
Primary Key: a special form of attribute that is used to reference items, similarly to an item ID
Sort Key: another special form of attribute that is used to organize items in a different sorting order
Streams: a constant stream of state-changing operations executed against a table
Query: operation to retrieve a particular item (or set of items)
Scan: operation to scan the entire table or a section of it
Filter: rules to apply after a query or scan has executed, but before results are returned to the requester.
Core Features of DynamoDB
Probably the most important feature of Dynamodb, it delivers automatic scaling of throughput and storage based on the performance or usage of your application. In a typical database server, the sysadmin takes care of scaling when the application encounters higher than usual traffic. With DynamoDB, you can create database tables that can store and retrieve any amount of data, and the scaling is automatically managed by AWS. This includes scaling up for higher traffic and scaling down for lower traffic, so you only pay for what you use.
DynamoDB supports both key-value and document data models. This enables you to have a flexible schema, so each row can have any number of columns at any point in time. This is crucial for growing businesses that have ever-changing requirements.
Re-defining database schema is a nightmare that many developers/database admins go through in a growing application. This data model flexibility saves offers a robust database solution for small as well as large businesses.
AWS takes care of DynamoDB tables replication automatically based on your choice of AWS regions (cross-region replication). Even distributed applications can have single-digit millisecond read and write performance using DynamoDB.
With replication in place, you don't have to worry about data availability. In the event of the primary source failure, you can easily access the data from a secondary reserve, reducing the probability of application downtime.
Backups & Recovery
DynamoDB provides On-demand backups for your tables that you can enable within the AWS console. You can also enable automatic backup and archiving of your data to other AWS solutions like S3.
DynamoDB also offers Point-in-time recovery. This protects your data from accidental write/delete operations. With Point-in-time recovery, you can restore your database to any point in time for the last 35 days. Point-in-time recovery is achieved by storing incremental backups of your database and that is managed automatically by AWS.
DynamoDB encrypts data at rest by default and also in transit using the keys stored in AWS Key Management Service (or customer-provided keys). With encryption in place, you can build security-sensitive applications that meet compliance and regulatory requirements. DynamoDB also provides access control via AWS IAM roles.
Monitoring is crucial to any business-critical application. It helps maintain reliability and also notify personnel in case of an event or failure. AWS offers detailed monitoring tools like CloudWatch Logs, CloudWatch Events, and CloudTrail Logs that will help you to watch, notify and debug all types of events in DynamoDB. You can also set custom triggers based on metrics like system errors, capacity usage, etc.
Now let’s compare DynamoDB with two of the popular database alternatives — MySQL and MongoDB.
DynamoDB vs MySQL
Obviously, there is a big difference between MySQL and Mongo DB because MySQL is a relational database. In terms of benefits, I think MySQL is limited because of the requirement of having a schema before you can start pushing data.
MySQL is great for many use cases as well. It is often called “The world’s most popular open-source database” and it delivers a fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server.
But being a NoSQL database provides DynamoDB much more flexibility in terms of data modeling. Even though AWS provides managed services for my SQL and other relational databases DynamoDB is a database designed by AWS and not just a hosted database solution. So this offers more improvements and features that MySQL and other relational databases can’t.
DynamoDB vs MongoDB
Dynamo DB and MongoDB are closely related to each other since both are NoSQL databases. But since DynamoDB is built and maintained by AWS it offers much more features and integrations especially with other Amazon services like S3, compare to MongoDB.
If I were running a growing company I would prefer using DynamoDB solely for the purpose of its scalability and cross-region replication features. AWS does not offer a managed MongoDB service but if you are looking for one, MongoDB Atlas would be a great alternative.
Another important feature of DynamoDB over MongoDB is that MongoDB is not secure by default and you have to configure security yourself. DynamoDB is secure by default, so it might be a better option if security is a deal-breaker for you.
AWS DynamoDB is a fully managed NoSQL database that can scale in and scale out based on demand. AWS takes care of typical functions including software patching, replication, and maintenance. DynamoDB also offers encryption at rest, point-in-time snapshots, and powerful monitoring capabilities. In a nutshell, it is a great option when you are building an application that needs a high-performance scalable NoSQL database.
DynamoDB Streams allow you perform change-data-capture (CDC) on your DynamoDB table and respond to updates in your table using Lambda functions. You can also pipe these changes into a Kinesis data stream.
Transactions allow you to do all-or-nothing operations across different items.
DynamoDB Global Tables is a feature that allows you to create Multi-Region Multi-Master setups across the globe with minimal latency.
PartiQL is a query language designed by AWS that’s similar to SQL and can be used across different NoSQL offerings.
DAX or the DynamoDB Accelerator is an in-memory write-through cache in front of DynamoDB if you need microsecond response times.
Comparative Analysis Between Amazon DynamoDB and Other Databases
Compared to other transactional databases, like Oracle, MSSQL, or PostgreSQL, AWS DynamoDB is schemaless, meaning it does not require conformation to a rigid schema of data types, tables, etc. This, though, also comes with a tradeoff: key advantages, like consistently high performance and millisecond latency, are compromised with ACID (atomicity, consistency, isolation, and durability) properties supported by a relational database.
Compared to other NoSQL databases, AWS DynamoDB supports data models like key-value pair (see figure below), and document data structures such as JSON, XML and HTML. But DynamoDB lacks support for columnar data sets, like Cassandra and HBase, and graph models such as Orient DB.
Top comments (0)