MongoDB not utilizing all memory in windows.

63 views
Skip to first unread message

Xu Guoming

unread,
May 24, 2016, 7:56:17 AM5/24/16
to mongodb-user

I have a stand-alone MongoDB instance running in windows. It's recently experiencing slowness and my troubleshooting has found the following symptoms:

  1. The slowness normally occurs after a full text search query against a huge collection. I guess this is because it swaps many pages in the collection from disk into memory hence data from other collections are squeezed out from memory.
  2. The server memory usage is capped around 55%. The server (Win2012) has 32GB of memory but MongoDB is not trying to utilize beyond 16GB.

I have seen a couple of Q&A in limiting MongoDB memory usage but not on how to encourage MongoDB to be more greedy.

  • MongoDB: 3.2.0
  • Storage Engine: wiredTiger
  • OS: Win2012
  • Memory: 32GB
Thanks. 

Rhys Campbell

unread,
May 24, 2016, 10:10:18 AM5/24/16
to mongodb-user
Have you specified the wiredTiger cache size? It allocates 60% - 1GB by default so perhaps kicking this up is the answer...

Xu Guoming

unread,
May 25, 2016, 10:56:36 PM5/25/16
to mongodb-user
Rhys, thank you very much. This is indeed the solution. 

Kevin Adistambha

unread,
Jun 2, 2016, 10:36:06 PM6/2/16
to mongodb-user

Hi,

The slowness normally occurs after a full text search query against a huge collection. I guess this is because it swaps many pages in the collection from disk into memory hence data from other collections are squeezed out from memory.

When a non-typical query forced MongoDB to swap your working set out of memory, subsequent queries would be required to wait until MongoDB is able to load your typical working set into memory again. This is one possible (and quite likely) cause of the slowness you observed.

The server memory usage is capped around 55%. The server (Win2012) has 32GB of memory but MongoDB is not trying to utilize beyond 16GB.

Did you mean you intentionally cap MongoDB’s memory usage to 55% using some method? Or is the 55% memory usage is what you observed?

I have seen a couple of Q&A in limiting MongoDB memory usage but not on how to encourage MongoDB to be more greedy.

MongoDB is “greedy” by default, and will utilize as much memory as possible in order to provide the best performance. The default WiredTiger cache setting is as Rhys pointed out, which is 60% of RAM minus 1 GB. Please note that this setting only affects WiredTiger’s cache and does not affect MongoDB’s total memory usage, which includes filesystem cache (managed by the O/S, and is not directly assigned to the mongod process), and other uses such as for aggregation framework.

MongoDB: 3.2.0
Storage Engine: wiredTiger
OS: Win2012
Memory: 32GB

If you are running MongoDB 3.2.0, I would recommend you to upgrade to the latest in the 3.2 series, which is currently 3.2.6 for bugfixes and improvements.

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages