Mogno slow - very high memory consuption by Mongo

Hi @Tamar_Nirenberg

Actual memory used (306122.0 MiB) seems higher than server’s RAM (188Gi).

I think it’s because it includes actual RAM + swap. It’s visible in free output that the system is using swap here. Up to 74GB of swap usage, it seems:

Swap: 191Gi 117Gi 74Gi

Typically swap usage means that the server doesn’t have enough RAM to properly service the workload. It may be fine if this is not a regular occurrence, but if this is happening all the time, you might need to upgrade the server’s hardware. One silver lining is that the presence of swap allows the server to keep running. Without it, the OOMkiller will just kill the process with the highest memory usage in a not very nice manner using signal 9 (MongoDB, in this case), which is a much more disruptive process.

You can check how much work the MongoDB server is doing by using mongostat command. If the output of mongostat indicates a heavily loaded server, you might need to increase the RAM of the server.

Memory usage seems very high, and looks llike mongodb is consuming more than 50% of the RAM:

It is entirely possible for MongoDB to use more than 50% of RAM. The main ~50% allocation is for WiredTiger use only, and MongoDB would need to allocate more RAM on top of this to service incoming connections (up to 1MB per connection), in-memory sorting, and other operational works.

Best regards
Kevin

2 Likes