Limit MongoDB RAM Usage

99封情书 提交于 2019-12-25 00:45:35

问题


How can I limit MongoDB RAM usage?

I have a server with 1GB RAM.

When I insert 10000 rows 13 times, MongoDB uses almost 95%, and I have to have RAM for other tasks like CRONS.

I tried the "Easy Steps ... page" to do this, but it says that need mongod_pid, and I don't know what is that and where is, I only know that I don't use mongod, I've installed mongodb-server.

Everything was perfect until I saw that MongoDB uses almost all my RAM.


回答1:


It's most likely you have no reason to worry. The majority of the RAM used by mongodb is simply filesystem cache and the operating system has full control over this cache, i.e. it can free up memory if required by another process.

By default, with MongoDB 3.4, the larger of either "256 MB, or 50% minus 1 GB of total RAM" are reserved for the WiredTiger cache, and this is the only part that can't be freed up by the OS.

So you are unlikely to see any issues when running any cron jobs or such. As long as none of your processes are killed by the "out of memory (OOM) killer", you are not running out of RAM.



来源:https://stackoverflow.com/questions/46718165/limit-mongodb-ram-usage

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!