Submit a blog to KDnuggets -- Top Blogs Win A Reward

Topics: AI | Data Science | Data Visualization | Deep Learning | Machine Learning | NLP | Python | R | Statistics

KDnuggets Home » News » 2021 » Mar » Tutorials, Overviews » MongoDB in the Cloud: Three Solutions for 2021 ( 21:n13 )

MongoDB in the Cloud: Three Solutions for 2021


An overview of pricing and compatibility for MongoDB Atlas, AWS DocumentDB, Azure Cosmos DB.



By Edward Krueger, Senior Data Scientist and Tech Lead & Douglas Franklin, Aspiring Data Scientist and Teaching Assistant

Figure
Photo by Yoel Winkler on Unsplash

 

This article will investigate the costs and features offered by MongoDB’s MongoDB Atlas, AWS Amazon DocumentDB and Azure Cosmos DB. We assume that we aren’t talking about mega-scale, enterprise solutions. We are looking for a more typical app.

One reason this is relevant is that MongoDB, the company, decided to end mLab services late this year. This is to migrate users to the companies newer platform, MongoDB Atlas. However, there are many cloud providers for MongoDB today. We will discuss MongoDB Atlas, Azure Cosmos DB, and AWS DocumentDB.

 

What is MongoDB?

 
MongoDB is a document-oriented database that stores data as BSON objects or documents organized into collections. These documents can be retrieved as JSON’s. This means you can store records without using the column and row structure found in RDBMS.

A MongoDB cloud database is a great solution for content management, product catalogs, geospatial data applications, and any project with rapidly changing data requirements.

 

Cloud providers

 
There are many MongoDB cloud solutions available. What solution a development team or company ultimately decides on will likely come down to features, pricing, and integration with your existing architecture.

All the options discussed here are managed cloud services. This means that all of the DB administration and security tasks required in modern databases will be handled by the service provider. Ignoring what the solutions have in common, let's break down some differences.

 

MongoDB Atlas

 
MongoDB, founded in 2007, is under pressure to get more users and make more money. The company built Atlas in 2016, acquired mLab in 2018 for $68 million, then deprecated mLab late in 2020.

MongoDB Atlas is the solution offered by MongoDB the company. As such, MongoDB Atlas is the most complete MongoDB solution. With MongoDB Atlas, you will have access to all the MongoDB features and methods, including map-reduce. Additionally, you will be able to run the v4.4, v4.0, or v3.6 API.

Another benefit of Altas DB is that you can be flexible with other cloud service providers (AWS, Azure, and GCP). We were easily able to convert our app to one running on GCP with MongoDB Atlas.

MongoDB Atlas does have a free tier. However, Cloud Atlas Pricing is about $57/month for 10GB storage with 2GB ram and 1 vCPU if you need more robust computing.

For more information on setting up MongoDB Atlas or migrating to MongoDB Atlas, check out this article.

MongoDB: Migrating from mLab to Atlas
Migrate your MongoDB to keep your Heroku apps working

 

Azure Cosmos DB

 
Azure Cosmos DB is the Microsoft Azure solution for Document Databases. Azure Cosmos DB uses RUs or resource units, making pricing slightly more opaque than the other cloud platforms. However, there are RU calculators you can use to convert to dollars and estimate costs.

Here is an Azure DB Monthly Cost Calculator.

Azure does have a free tier that grants the first 400 RU/s and 5 GB of storage in the account.

Azure Cosmos DB free tier makes it easy to get started, develop and test your applications, or even run small production workloads for free. The Free tier comes with all the benefits and features of a regular Azure Cosmos DB account. Cosmos DB uses the MongoDB v3.6 API and does not support map-reduce.

After your free credits are used up, Cosmos DB costs are lower than competitors. For 10GB data with 1.5GB ram with minimal use will cost about $25/month.

Additionally, Azure now offers a serverless option. This is great for inconsistent use or low use apps, like internal business apps or proof of concepts. There is no minimum charge involved when using Azure Cosmos DB in serverless mode. Azure Cosmos DB serverless only bills you for the RUs consumed by your database operations and the storage consumed by your data. This can reduce costs drastically for infrequently or irregularly accessed apps.

That being said, serverless is not a good solution for regular data loads. Serverless does provide automated scaling; however, costs can be high.

For more information on setting up an Azure Cosmos DB or migrating to Cosmos DB, check out this article.

MongoDB: Migrating from mLab to Azure Cosmos DB
How to migrate your mLab database to Azure Cosmos DB to keep your app running.

 

AWS DocumentDB

 
Amazon Web Services solution is Amazon Document DB. AWS DocumentDB has no free tier. The cheapest instance available, db t3.medium, has 10GB storage with 4GB RAM and 2 vCPUs is about $60/month. Notice that this is about double the RAM offered by Azure and Atlas.

With AWS DocumentDB, you have the option of using the v3.6 or v4.o API. This platform lacks the map-reduce functionality available in Atlas. Vendor lockin is another thing to keep in mind with AWS. If your company already uses AWS services over other cloud providers, this solution can synergize well.

Vendor lock-in is not impossible to get around, but it is additional work and expense. For Example, to use AWS DocumentDB with a Heroku app requires you to get Heroku enterprise, which is expensive.

Amazon DocumentDB is a VPC-only service and doesn’t support public endpoints. As a result, you can’t connect directly to an Amazon DocumentDB cluster from an environment outside AWS. However, you can connect from a machine outside AWS using an SSH tunnel.

 

Conclusion

 
Teams will need to consider features, pricing, and their existing architecture to choose their best cloud MongoDB solution. Some of the decisions will be easy; for example, if you need map-reduce, choose MongoDB Atlas. If you are going to make a low/sporadic use app use Azure Cosmos Serverless to save on costs.

For predictable loads, Azure serverless can be rough. People often choose serverless options because they scale very easily. This issue is that mega scaling serverless can cost be unexpectedly high. However, if every amount of scaling means additional revenue, you have variable costs corresponding to variable revenue. Consider an online shop of black Friday, for example. Failure to accommodate extra traffic via auto-scaling is a disaster for lost revenue.

If your application is hosted on Heroku (not enterprise), choose MongoDB Atlas or Azure Cosmos. With MongoDB Atlas, you can choose any cloud provider you like and use the latest MongoDB API features. This flexibility is not available with Amazon Document DB or Azure Cosmos DB. These options locking you into their respective cloud vendors while running older versions of the DB API.

If your company has some existing projects using AWS and or you like the platform, AWS DocumentDB can be a great solution. Just keep in mind compatibility issues with other cloud services.

AWS Amazon Document DB and Azure Cosmons support most of the features you need to create an application. The only feature we note that is lacking is the map-reduce method. So if you are using MongoDB to use this feature, Document DB or Cosmos may not be a good solution for you; Atlas will better serve your needs.

 
Edward Krueger is a Senior Data Scientist and Technical Lead at Business Laboratory and an Instructor at McCombs School of Business at The University of Texas at Austin.

Douglas Franklin is a Teaching Assistant at McCombs School of Business at The University of Texas at Austin.

Original. Reposted with permission.

 
Related:


Sign Up

By subscribing you accept KDnuggets Privacy Policy