关于MongoDB调小WiredTiger internal cache能避免系统内存撑爆吗?

线上MongoDB服务器最近经常宕机 通过监控平台推测应该是内存撑爆导致 如下图所示 28号凌晨1点内存已经满了

clipboard.png

使用的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会多一点而已啊。

阅读 3.6k
1 个回答

请问问题解决了吗

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏