conquester
conquester

Reputation: 1132

How to free up RAM being used by MongoDB?

I am on a DigitalOcean Droplet.

When Mongodb has ran for too long it eats up the RAM on my server thus leaving little room for other processes. I read somewhere that restarting mongodb makes it write the data to the disk and thus free up the RAM. I restarted it using:

sudo service mongodb restart

But that didn't affected the RAM. Then I rebooted the server which did freed up the RAM. My question is that why restarting mongodb doesnt make it write the cache to the disk but rebooting does? Rebooting is not a viable option always. How can I make it write out the data to disk without rebooting?

Upvotes: 2

Views: 2528

Answers (1)

Saleem
Saleem

Reputation: 9008

MongoDB doesn't manage memory but use it and use it heavily for caching and other operations. Said that its OS responsibility to free up memory when required. This is the reason, when you restart MongoDB, it doesn't free memory but when OS restarts, everything get initialized.

See https://dba.stackexchange.com/questions/19491/mongodb-ram-requirements

Your best bet is install MongoDB on dedicated machine or VM.

Upvotes: 1

Related Questions