Over a million developers have joined DZone.

MongoMem: Optimize Memory Use in MongoDB

· Performance Zone

See Gartner’s latest research on the application performance monitoring landscape and how APM suites are becoming more and more critical to the business, brought to you in partnership with AppDynamics.

MongoDB users: do you have a way to tell how much memory each collection is using? For the Wish Engineering team, the answer was "no," and that's why they developed MongoMem. MongoMem allows MongoDB developers to precisely locate collections in need of memory-use optimization, rather than searching for problems based on intuition. According to the Wish team's overview of MongoMem, the need was clear: 

In our early days, we kept using a lot more memory than we thought we should be, but we were running blind when we tried to decide where the low-hanging fruit was to optimize. After plenty of frustrating optimizations that didn’t make much difference, we decided that we really needed better information, and MongoMem was born.

The Wish team's overview goes into detail on how MongoMem works - mincore calls and the collStats command do most of the work - what you can do with it, and even details some of the plans for MongoMem's future. Overall, though, it's a pretty straightforward little tool:

For each collection, it prints:

  • Number of MB in memory
  • Number of MB total
  • Percentage of the collection that’s in memory

You can find MongoMem on GitHub (with the usage instructions repeated), so if you're looking for some insight on how to keep MongoDB from overdoing it on memory, this might be a useful tool for you.

The Performance Zone is brought to you in partnership with AppDynamics.  See Gartner’s latest research on the application performance monitoring landscape and how APM suites are becoming more and more critical to the business.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}