amazon-web-servicesamazon-dynamodbaws-documentdb-mongoapi

Difference between AWS DynamoDB vs. AWS DocumentDB(Newly launched service)?


AWS recently launched new service DocumentDB similar to MongoDB interface.
What is the difference between AWS DynamoDB vs. DocumentDB services?


Solution

  • A major difference is that DocumentDB is a middle step between MongoDB and DynamoDB.

    DynamoDB is a fully managed scalable service where you set the upper limit of it's potential.

    DocumentDB is a bit more hands on and you have to select the number of instances for the cluster and the instance sizes. This means you would need to keep an eye on their usage / performance but not to the extend of MongoDB.

    MongoDB would be the most flexible but also require the most maintenance.

    All are good for performance depending on the application, but it depends on how flexible you want with the cost of more maintenance.

    The other factor is the pricing model. Both MongoDB (Atlas) and DocumentDB you pay per hour (plus usage for DocumentDB). DynamoDB you can pay based on provisioned resources or on-demand (pay for what you use).

    Edit: I've written a more extensive article based on my experiences with the three: https://medium.com/@caseygibson_42696/difference-between-aws-dynamodb-vs-aws-documentdb-vs-mongodb-9cb026a94767

    Some Key differences

    1. Amazon DynamoDB is a fully managed NoSQL database service. It provides fast and predictable performance with scalability. You can use Amazon DynamoDB to create a database table that can store and retrieve any amount of data, and serve any level of request traffic. Document DB is based upon an open-source document database Mongo DB and leading NoSQL database .Document DB is based upon open-source Mongo DB and is a document database designed for less of development and scaling.

    2. DynamoDB uses tables, items and attributes as the core components that you work with. A table is a collection of items, and each item is a collection of attributes. DynamoDB uses primary keys to uniquely identify each item in a table and secondary indexes to provide more querying flexibility.

    MongoDB / Document DB uses JSON-like documents to store schema-free data. In Document DB, collections of documents do not require a predefined structure and columns can vary for different documents. Document DB has many features of a relational database, including an expressive query language and strong consistency. Since it is schema-free, MongoDB/Document DB allows you to create documents without having to create the structure for the document first.

    1. In DynamoDB, you can create and use a so-called secondary index for similar purposes as in RDBMS. When you create a secondary index, you must specify its key attributes and after you create it, you can query it or scan it as you would a table. DynamoDB does not have a query optimizer, so a secondary index is only used when querying or scanning.

    Indexes are preferred in MongoDB/Document DB. If an index is missing, every document within the collection must be searched to select the documents requested by the query. This can slow down read times.

    1. DynamoDB is popular in the gaming industry as well as in the internet of things (IoT) industry.

    To summarize, Document DB can be a good choice if you need scalability and caching for real-time analytics; however, it is not built for transactional data (accounting systems, etc.). Document DB can used for mobile apps, content management, real-time analytics and applications for IoT. If you have a case with no clear schema definition, DocumentDB can be a good choice.