线上MongoDB服务器最近经常宕机 通过监控平台推测应该是内存撑爆导致 如下图所示 28号凌晨1点内存已经满了
使用的MongoDB版本是3.2.10 默认使用的是WiredTiger 从官网文档可知 其同时包含如下缓存
-
WiredTiger internal cache
- 默认大小为 32 * 0.6 - 1 = 18GB (60% of RAM minus 1 GB)
-
filesystem cache
- 系统剩多少 用多少
Via the filesystem cache, MongoDB automatically uses all free memory that is not used by the WiredTiger cache or by other processes.
而MongoDB只能控制internal cache
大小
To adjust the size of the WiredTiger internal cache, see storage.wiredTiger.engineConfig.cacheSizeGB and --wiredTigerCacheSizeGB.
我在想针对内存撑爆问题 调小internal cache
有用吗? 如由默认的18GB --> 9GB 多出来的内存不还是被filesystem cache
占用了 内存依然会撑爆的啊
另外 filesystem cache 不是应该有LRU机制吗? 照说内存应该也不会用尽啊 只是page fault
会多一点而已啊。
请问问题解决了吗