The saying “Databases are easy to get started with but hard to master” is as valid today as it’s ever been. MongoDB monitoring done right is key to success as it allows you to get answers for the most important questions, like load characteristics and distribution.
Although MongoDB comes pretty much ready-to-run out-of-the-box, the challenges in mastering MongoDB are no different than that of any other database product. The firsts step in making any database a top performer is to choose the right technology.
Choose the right technology
As far as public perception goes, databases should be flexible and powerful enough to perform a wide range of tasks. The truth is though that different databases have different advantages. The old saying, “The right tool for the job” is one of the most overused phrases in IT, but it remains true today. MongoDB really shines in specific areas, but it performs only at average levels in other areas. In contrast to classic RDBMS, NoSQL solutions aren’t designed to be one-size-fits-all persistence solutions.
Identifying the characteristics
To decide on the right technology, you need to know how your databases will be accessed. Will the database be used mostly for read-, write-, or aggregation tasks? For each use case there’s a “best fit” database.
Dynatrace monitors database metrics including numbers of calls and response times and visualizes them according to read-, write-, and delete operations. This is done for all supported database technologies, including both SQL and NoSQL. This simplifies the process of identifying the perfect database fit for your organization.
Are you interested in learning about the load characteristics of your service?
Microservices and polyglot persistence
Microservices-based environments can and should provide dedicated, specialized databases for each service and specific persistence use case. You don’t have to select a single generic database to handle all your services’ use cases—you can get the highest-performing database solution for each of your services.
If you have several services in your ecosystem, you likely have at least one use case that’s ideally suited for MongoDB. By evaluating the load characteristics of your database in combination with the application that’s accessing it, you should have no trouble identifying the best performer for each of your services.
Choosing a technology often depends not only on the technology itself but also on the community and tools that support it. This is why Dynatrace monitors so many technologies with a flexible, unified approach.
The right monitoring solution fully embraces the full versatility of your environment.
Two great use cases
I’d like to share two MongoDB use cases that I have experience with. These use cases demonstrate how MongoDB delivered great performance and significant value to an e-commerce solution I worked on.
Pre-join your data
MongoDB doesn’t offer joins like relational databases do. Any joining of data must be done in your application code. But guess what? MongoDB’s ability to work with complex documents instead of flat tables allows you to store readily joined data inside MongoDB!
Our e-commerce solution directly imported as much data as possible from an ERP system. By simply flagging the relevant products in the ERP system, the products were made available for purchase in the online shop. The ERP system’s database was an RDBMS and each product required a couple of joins.
As we knew exactly which data we needed, we selected them in advance and stored them in a pre-assembled document inside MongoDB. When a customer viewed a certain product page in their browser, all the data was collected from MongoDB as a single, pre-assembled data set.
Needless to say, this really improved the performance and responsiveness of the site.
Query entire trees as unified components
The other perfect fit for MongoDB in our e-commerce project was persisting trees of cascaded categories. Here again, category trees can easily be stored in relational databases—it’s been done for ages, after all.
But a single document in MongoDB can store an entire category tree that can be queried and returned in a single step, same as with the product catalog data use case I mentioned previously.
Your load times will plunge and your visitors will love it.
When to choose an RDBMS
There are two use cases for which I don’t recommend using MongoDB: two-phase commits and reporting capabilities.
Two-phase commits aren’t supported by MongoDB. If transactional behavior is a must for your use case, go with an RDBMS—two-phase commits are a core competency of RDBMS.
As far as I know, SQL is unmatched in combining different types of data. Usually, reporting isn’t performed in real-time, so performance isn’t much of a concern here. If you need to aggregate across a defined set of data for reporting purposes, go with an RDBMS. SQL databases are blazingly fast at joining data when indices are set correctly.
For the e-commerce solution I worked on, we used a SQL database to keep track of all orders and details. This enabled us to assemble precise reports for products, customers, regions, and any other detail we could think of.
Versatile reporting for you. High performance for your customers.
With MongoDB databases available as online service, it’s easy to migrate to the cloud in stages—moving one service over at a time. And because Dynatrace’s unique approach to monitoring enables you to see which data center each of your databases runs on, you can track how performance changes as you migrate individual services to the cloud.
When migrating dozens or even hundreds of services, it’s easy to lose track of the changes you’re making and their impact on your application’s performance.
You’re about to migrate into the Cloud?
As one of the pioneers of the NoSQL revolution, MongoDB is clearly a great database solution. And a supportive community and helpful documentation make it easy to get started with MongoDB. You’ve likely read both positive and negative reviews of MongoDB. The bottomline for me is that you won’t know how well MongoDB will perform for your services until you try it.
Benefit from MongoDB monitoring as a real accelerator
And with the right monitoring solution in place, you’ll know the behavior of your apps and databases in production within about five minutes following installation.
Get the best insight into your environment and MongoDB with your free Dynatrace 30-day trial!