DynamoDB vs Amazon Neptune - The Ultimate Comparison
Written by Chameera Dulanga
Published on September 14th, 2022
Time to 10x your DynamoDB productivity with Dynobase [learn more]
Amazon DynamoDB and Amazon Neptune are two of the most popular cloud-based database services managed and offered by Amazon Web Services (AWS). These two services are widely used as NoSQL database solutions around the globe.
In this article, I will be discussing what these two services are and their similarities and differences.
DynamoDB and Amazon Neptune: An Overview
DynamoDB
AWS DynamoDB is a NoSQL database solution fully managed by AWS, which guarantees millisecond-range latency at any scale. It supports key-value and document data models and has excellent features like security, backups, caching (with DAX), and scalability to build reliable applications. DynamoDB is particularly well-suited for applications that require consistent, single-digit millisecond response times at any scale.
Amazon Neptune
Amazon Neptune is a graph database service offered and fully managed by AWS. It allows you to build applications using highly connected datasets while guaranteeing millisecond-range latencies. It is optimized to handle billions of relationships and supports graph query languages like Neo4j's openCypher, W3C’s SPARQL, and Apache TinkerPop Gremlin. Neptune is ideal for use cases that involve complex queries on interconnected data, such as social networks, recommendation engines, and fraud detection systems.
Shared Attributes for DynamoDB and Amazon Neptune
As mentioned, both DynamoDB and Amazon Neptune are fully managed by AWS. Hence, you do not need to think about database management tasks like provisioning, backups, and configurations.
In addition, both services are highly scalable, available, and reliable. You can easily back up these databases using point-in-time recovery, continuous backups, or maintaining multiple replicas across availability zones. Also, both DynamoDB and Amazon Neptune support encryption at rest.
On the other hand, they have some significant differences since DynamoDB is a document and key-value-based database, whereas Amazon Neptune is a graph-based database.
So, let's discuss more on the features of these two services to understand their differences and similarities clearly.
Latency and Performance
DynamoDB
Regardless of the table size, DynamoDB ensures millisecond latency at any scale. It can handle more than 20 million requests per second and up to 10 trillion requests per day.
In addition, it uses SSDs to minimize the latency and improve the response time when reading and writing data. You can also use the DynamoDB Accelerator (DAX) and in-memory caching support to reduce the data reading time to microseconds. DynamoDB's performance is highly predictable, making it suitable for applications with stringent latency requirements.
Amazon Neptune
Amazon Neptune is also well known for its high-performance graph database engine. It allows you to work with highly connected datasets and applications that require high throughput and low latency graph queries. Most importantly, Amazon Neptune is capable of handling 100,000 queries per second.
In addition, Amazon Neptune uses its in-memory optimized architecture and scaling ability to evaluate queries on large graphs quickly. It also uses query optimization for SPARQL queries and Gremlin traversals. Neptune's performance is particularly beneficial for applications that need to traverse complex relationships quickly and efficiently.
Availability and Durability
DynamoDB
DynamoDB replicates data among multiple availability zones to ensure high availability. For example, AWS will automatically replicate your table in 3 availability zones within a selected region, maintaining data's high durability and availability even in physical disasters like fires, earthquakes, and power outages.
Furthermore, you can replicate your DynamoDB tables across multiple regions of your choice to improve high availability and durability using DynamoDB global tables.
Learn more about DynamoDB Disaster Recovery.
Amazon Neptune
Amazon Neptune improves the fault tolerance to disk failures by dividing database volume into 10 GB blocks and spreading them across multiple disks. It keeps six copies of your data across three availability zones. Also, it has a self-healing feature that scans the data blocks and disks continuously and repairs any issues.
In addition, you can use up to 15 read replicas to improve the data availability, and all the changes made in the primary will be visible in other replicas within tens of milliseconds. Furthermore, restarting the database after a crash takes less than 60 seconds since you do not have to replay the redo log from the last database checkpoint.
Security
DynamoDB
AWS IAM policies and rules can be used to control access to DynamoDB tables. In addition, AWS KMS encryptions can also be used to improve the security of DynamoDB tables. You can use AWS-owned keys, AWS-managed keys, or Customer-managed keys to encrypt DynamoDB tables using AWS KMS.
Learn more about DynamoDB Security.
Amazon Neptune
Similar to DynamoDB, Amazon Neptune supports encryption at rest with AWS KMS using the three types of keys mentioned above. Encrypting an Amazon Neptune instance using AWS KMS will keep all the automated backups, snapshots, and replicas in the same cluster.
Apart from that, all the Amazon Neptune instances should be created on VPCs. So, you have complete authority to decide who can access the database. Additionally, Neptune supports fine-grained access control using IAM roles and policies, ensuring that only authorized users can perform specific actions on the database.
Scalability
DynamoDB
DynamoDB tables are highly scalable. It provides two capacity modes, and you can select one based on your requirements.
- On-Demand - DynamoDB tables are automatically scaled up and down based on the workload. Suitable for ad-hoc traffic.
- Provisioned capacity mode - The user needs to define the auto-scaling configurations, including the minimum and the maximum number of capacity units. Suitable for predictable traffic.
Amazon Neptune
Amazon Neptune has a minimum storage limit of 10 GB and a maximum storage limit of 64 TB. Based on your use, it will automatically scale from 10 GB to 64 TB in 10 GB increments. Neptune's ability to scale storage seamlessly makes it a robust choice for applications that experience rapid growth in data volume.
Backups & Restore
DynamoDB
On-demand backups and point-in-time backups (PITR) are the two backup and restore mechanisms of DynamoDB.
- On-demand backups - Require you to schedule backups manually. It is more suitable for long-term retentions and archiving purposes.
- Point-in-time recovery - Backups are automatically created, and you do not need to worry about scheduling. Instead, it will continuously create backups, allowing you to restore data within the last 35 days up to seconds of precision.
Amazon Neptune
Amazon Neptune automatically creates backups of your cluster volumes and keeps them up to a retention period defined by you. You can define a retention period between 1 to 35 days. These backups are continuous and incremental. So, similar to DynamoDB, you can quickly restore data within the last 35 days without causing any performance impact on the database.
If you want to maintain backups for more than 35 days, you can create a snapshot of your cluster volume. However, you must create a new database instance to restore data from a snapshot.
Pricing
DynamoDB
Core features are billed based on usage. However, this does not include optional features like backups. The pricing model will be decided based on the capacity model you choose:
- On-demand capacity mode - The total price for read and write units will be decided based on the traffic.
- Provisioned capacity mode - The read and write capacity units of the user will decide the total price.
Besides, DynamoDB free tier provides 25 GB of data storage, 2.5 million streams of read requests, and 100 GB of data transfers.
Amazon Neptune
Amazon Neptune on-demand instances charge you by hourly usage. For example, a db.t3.medium instance will cost 0.098 USD per hour. However, this pricing schema applies to both primary instances and replica instances. If you keep read replicas in multiple availability zones, you must pay for all the replicas in addition to the primary instance.
Amazon Neptune storage and I/O charges are also billed based on usage. For example, storage will cost 0.10 USD per GB-month, and I/Os will cost 0.20 USD per 1 million requests.
In addition, Amazon Neptune provides 750 hours of the Neptune db.t3.medium or db.t4g.medium instance, 10 million I/O requests, 1 GB of storage, and 1 GB of backup storage for free for 30 days under the free tier.
When and Where to Pick Which Service
DynamoDB
DynamoDB is an excellent option if you are looking for a fully managed NoSQL database solution. Among many other applications, below are some of the most popular use cases of DynamoDB:
- Scalable web and mobile applications.
- Content management.
- Shopping carts.
- Gaming and real-time streaming platforms.
- Applications with high I/O needs.
Amazon Neptune
As mentioned, Amazon Neptune is a great option for applications with highly connected and complex data. Some of the most common instances where Amazon Neptune is used are:
- Recommendation engines.
- Knowledge graphs.
- Fraud detection.
- Network security.
- Social networking.
Conclusion
This article went through the similarities and differences between DynamoDB and Amazon Neptune. I hope you now have a good understanding of their features and when you should choose them.
Thank you for reading!