MongoDB limit memory


I am using mongo for storing log files. Both mongoDB and mysql are running on the same machine, virtualizing mongo env is not an option. I am afraid I will soon run into perf issues as the logs table grows very fast. Is there a way to limit resident memory for mongo so that it won't eat all available memory and excessively slow down the mysql server?

DB machine: Debian 'lenny' 5

Other solutions (please comment):

  • As we need all historical data, we can not use capped collections, but I am also considering using a cron script that dumps and deletes old data

  • Should I also consider using smaller keys, as suggested on other forums?


For Windows it seems possible to control the amount of memory MongoDB uses, see this tutorial at Captain Codeman:

Limit MongoDB memory use on Windows without Virtualization

For version 3.2 , which uses wiredTiger engine, the option --wiredTigerCacheSizeGB is relevant to the question. You can set it if you know what you are exactly doing. I don't know if it's best practice, just read from the document and raise it here.

By : pu.guan

This video can help you solving your question :)
By: admin