Is there a way to release RAM occupied by mongodb indexes, after dropping collection?

881 views Asked by At

The problem is that we have a huge dataset consists of 50 mln records and almost all fields are indexed, that causes huge consumption of RAM, and after collection is deleted resources are not released, I know that this can be solved by restarting the server, but this solution is not applicable under our situation. So, my question - is there a way to release RAM resources without restarting mongo server? Version of Mongo is 4.4. Thanks in advance.

1

There are 1 answers

3
JJussi On

Not directly... MongoDB never make memory free, it just replaces it or allocates more. But if you start reading from the disk data what you're going to need, that data will replace that part of memory. Base problem is that MongoDB will always use (eventually) all free memory what is available and try to keep in memory all active data. So, reading data from the disk, makes that data "active" and will change the content of disk cache in the memory.