DynamoDB vs Amazon RDS - The Ultimate Comparison
Written by Nishani Dissanayake
Published on 2021-12-25
DynamoDB and Amazon RDS are two popular cloud-based database services managed and offered by Amazon Web Services (AWS). These two services are widely in use around the globe.
In this article, I will be discussing what these two services are and their similarities and differences.
DynamoDB and Amazon RDS: An Overview
DynamoDB is a database service for NoSQL data fully managed by Amazon Web Services. It is swift, reliable, and scalable, which makes working with NoSQL data much easier to handle.
On the other hand, Amazon RDS stands for "Relational Database Service", and we mostly use it for structured and relational data (SQL). Unlike DynamoDB, RDS is the name of the service rather than the database engine itself. So, we can choose from six database engines, including Amazon Aurora, MySQL, and MariaDB.
Shared Attributes for DynamoDB and Amazon RDS
DynamoDB and Amazon RDS are both fully-managed by AWS, thus making the administration more manageable and allowing developers to focus more on using the database service. In addition, both of them are reliable and highly scalable with automated scalability and backup.
The significant difference between these two services is that Amazon RDS is relational, whereas DynamoDB is a NoSQL database engine.
In terms of storage size, DynamoDB stands out with its ability to support tables of any size. But with RDS, the storage size changes based on the database engine we use.
- Aurora engine: 128 TB
- MySQL, MariaDB, Oracle, PostgreSQL engines: 64 TB
- SQL Server engine: 16 TB
Performance of DynamoDB vs Amazon RDS
DynamoDB is known for high-performance as it can cope with more than 10 trillion requests within a single day with peaks greater than 20 million requests per second.
There is less latency and response time when reading and writing data because of the high IO performance of SSDs. In addition, the in-memory cache, DynamoDB Accelerator (DAX), can enhance the read performance by ten folds. That can reduce the reading time from milliseconds to microseconds.
No matter the size of the tables you have, the latency of DynamoDB is minimum, and it maintains within milliseconds. So, the performance of this database engine is considerably high, if you use the indexes and partitioning properly.
There are two SSD backed options for storage in Amazon RDS. A high-performance choice for OLTP applications and another cost-effective solution for general-purpose use.
The general-purpose solution has a performance that delivers at 3 IOPS per provisioned GB that can scale up to 3000 IOPS. The high-performance option can deliver up to 40000 IOPS per database instance. This high-performance IOPS rate is maintained throughout the lifetime of the database instance.
Availability and Durability
In DynamoDB, the data is replicated across three availability zones automatically. However, users do not have a choice to choose availability zones, they can only choose a region. The data replication over multiple physical nodes ensures data availability even when power outages or significant natural disasters. Even if one node fails, the data flow will continue with the other nodes without interruption.
Amazon RDS uses Multi-AZ deployments to enhance the availability of its databases. So, in case of any hardware failure, the requested data will be made available by replacing the compute instance powering the database instance with a functional one.
However, it comes optional as the cost also increases, since we need multiple instances(master-slave) in RDS to provide active-passive failover and high availability.
DynamoDB integrates fairly well with IAM. Since its a cloud-native database offering, it also provides fine-grained access control to limit access using IAM policies. Besides, Amazon RDS also integrates with IAM for authentication for MySQL and PostgreSQL engines.
Encryption with KMS: AWS KMS (Key Management Service) encryption keys ensure DynamoDB security. The KMS allows creating, storing, and managing the encryption keys. There are three options for the users to encrypt the tables with DynamoDB.
- AWS-owned key (free and encrypts the key by default)
- AWS-managed key (there will be a fee, and stores the key in the user's account)
- Customer-managed key (here also, there is a fee, and the user has complete control over the key)
Amazon RDS also uses AWS KMS. These keys are AWS-managed. The users can also use SSL to enhance the security of data.
Comparing Other Features of DynamoDB and Amazon RDS
PITR (Point-in-time recovery) in DynamoDB provides constant backups, and for the preceding 35 days, the user can restore the database table to any point in time. The performance of the database will not be affected by the data backup and restoration. It is easy and does not interrupt the user's work in any way.
In RDS also, PITR is enabled by the automatic backup for your database instance. The user-initiated backups are stored as database snapshots in Amazon S3 storage until the user intentionally deletes them.
Amazon DynamoDB is highly scalable as it can support virtually any table size. It seamlessly scales based on the requirement when the workloads go up and down, reaching traffic levels. The high scalability does not affect the performance. There are two modes the user can pick from,
- Provisioned capacity mode (the user can set a limit)
Similar to DynamoDB, Amazon RDS is also highly scalable and supports auto-scaling. The procedure is simple, and with just a few clicks, the user can set the auto-scaling maximum capacity. In addition, the user can determine the scalability as on-demand or run with a reserved capacity.
So far, we have discussed comparing the shared attributes of both DynamoDB and Amazon RDS. Now let's see when and where to use the best database solution based on the requirements.
When and Where to Pick Which Database Service
It is essential to determine which database suits you best in your case. So, given below are some use cases for using DynamoDB and Amazon RDS.
Use cases for DynamoDB
There are instances where using relational databases can be costly and complicated. In such cases, the best solution is to opt for NoSQL databases.
When you are already using AWS services, the best NoSQL database model is DynamoDB. It is highly scalable and scaling, or backups do not interrupt the performance. There is no need for manual scaling.
So, this database solution is ideal for systems that require a high speed in data reading and writing. Below are several examples of instances where we can use DynamoDB.
- Real-time bidding
- Shopping carts
- Mobile applications
- Content management
- High I/O needs
- Unstructured data in gaming applications
You can read more about the use cases for DynamoDB here.
Use cases for Amazon RDS
As mentioned above, Amazon RDS is used to store structured and relational data. Therefore, we can use RDS for any relational backend database.
Enterprise applications usually have to have a relational database model because of the nature of storing data. So, in such instances, we cannot use NoSQL databases like DynamoDB. In that case, RDS is a solution for traditional applications, enterprise-grade applications, CRM, and e-commerce solutions. We can also use it in a source system for data warehouses.
The standard pricing for DynamoDB counts for reading, writing and storage consumed by data. The charges alter based on the additional services the user subscribes. Besides, the way DynamoDB calculates the read and write units is a bit tricky. For reads it takes 4KBs as a single read and 1KB write is taken as a single write unit. Also, there is an effect depending on the GSI's you use in a table.
There are two pricing tiers:
On-demand capacity mode: The payment is calculated based on the application traffic. This option allows the database instance workload to scale up and down as necessary. The user need not specify any throughput. This choice is ideal if you have less predictable database traffic and want to pay for only what you use.
Provisioned capacity mode: In this option, the user must specify the reads and writes per second. If necessary, the user can use auto-scaling to adjust the table size automatically. We can use this solution if the application traffic is predictable and consistent.
Amazon RDS charges a monthly amount from the user for each database instance. RDS also comes with a pay-as-you-go model. In addition, there are several pricing tiers based on the database engine (MySQL, Aurora, etc.) and the server capacity we use.
When it comes to pricing, Amazon RDS also has an On-demand pricing model, similar to the DynamoDB. But this is a bit more expensive than the reserved instance pricing available for Amazon Aurora. In reserved instances, the user needs to make the payment on a long term basis, like one or three years.
You can read all about the pricing options here.
In this article, I discussed the similarities and differences we can find between two popular database services, DynamoDB and Amazon RDS, fully managed by Amazon Web Services (AWS). I hope you all got a good understanding of them and their use cases.
Thank you for reading!
© 2022 Dynobase