I am helping to support a Node.js application which uses MongoDB on an EC2 instance as the back end. The database is about 14 GB and the largest table has a little over 15 million documents.

To test, I have set up MongoDB on an m5.large instance (2 vcpu, 8 gb ram) and DocumentDB on an db.r5.large instance (2 vcpu, 16 gb ram).

When performing operations such as aggregate queries on the largest table, the CPU usage on DocDB is abnormally high and never drops back down. I have seen it get stuck at 99% CPU usage for days with seemingly nothing happening other than a couple aggregate queries which are each taking 10 seconds to complete.

The same test on the MongoDB instance leads to peak CPU usage of 10% and the aggregate queries complete in less than 1 second.

What could possibly lead to such a disparity in performance between AWS DocumentDB and MongoDB? I thought DocDB would be a simple lift and shift type of service but it is proving to be a giant pain....

  • DocumentDB has an entirely different server implementation from MongoDB so performance characteristics and feature support will vary. DocumentDB implements a subset of MongoDB commands/API and has many functional differences even within the commands that are implemented. If you want a straightforward migration from self-managed MongoDB to a hosted service on AWS, MongoDB Atlas runs MongoDB Enterprise server and can live migrate from a compatible source replica set. – Stennie Feb 22 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.