mongodb占物理内存
ringa_lee
ringa_lee 2017-04-24 09:13:16
0
4
890

mongodb占物理内存,我们一台服务器8G内存,没有开mongodb的时候,物理内存只占11%,当开了mongodb,mongodb进程的内存显示是60M,但物理内存已经是99%,请问是什么原因?有没有优化的办法,我们是在WINDOWS系统.

ringa_lee
ringa_lee

ringa_lee

reply all(4)
伊谢尔伦

I remember, a person named Tang Jianfa said: MongoDB does not eat memory, but its original intention is to deliberately occupy memory.

大家讲道理

Mongodb itself does not do memory management, and its memory management completely depends on the system. You can use System Performance Monitor to check memory and virtual memory. To put it simply, mongdb will eat as much memory as you have. It is so greedy that it will put most of the hot data in the memory to improve performance. After all, this is also its advantage.
Our server is Windows Server 2008, with 32G of memory. After running for a period of time, it was all used up, but the performance was surprising. However, there was not only mongodb on that server, so it often affected other programs. Later we tried to use Windows System Resource Manager WSRM limits the memory of the mongodb process. It is indeed effective. You can try it.
But I started using mongodb the year before last. The version at that time was relatively old. After limiting the memory, mongodb was very unstable and occasionally hung up. Looking at the logs, it generally meant that the mapped memory could not be found. So later we gave up limiting memory and switched to using mongodb commands to release memory at fixed points every day{closeAllDatabases:1}
This command also has a cost, it will be blocked until the command is complete, and the efficiency will be reduced immediately after it is released, and it will take a period of "warm-up" to slowly recover.
I think the latter method is good, and through observations over the past two years, everything is relatively stable. Of course, it would be great if you could give mongodb a separate server.

迷茫

The new MongoDB engine will consider itself to be the only important service in the system, so it will try to occupy as much memory as its own cache (not the operating system's cache). If you need to reserve memory for other processes, or have multiple MongoDB instances, you can use the --cacheSizeGB parameter to limit the MongoDB cache size.

刘奇

I wrote a script to clear the cache every early morning. . .
http://onwise.xyz/2017/02/23/...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template