代码改变世界

mongodb对内存的使用

  abce  阅读(163)  评论(0编辑  收藏  举报

1.默认的分配策略

1
2
Starting in 3.4, the WiredTiger internal cache, by default, will use the larger of either:
50% of RAM minus 1 GB, or 256 MB.

即(总内存×50%-1GB)和(256MB)两者中的较大值。

2.配置内存

1
2
3
4
5
6
7
8
9
10
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
  mmapv1:
    smallFiles: true
  wiredTiger:
    engineConfig:
      configString : cache_size=160M

3.查看mongodb对内存的使用:

1
2
> db.serverStatus().mem
{ "bits" : 64, "resident" : 7316, "virtual" : 9530, "supported" : true }   

 

目前有4个可配置参数支持WiredTiger存储引擎的驱逐策略(一般情况下无需修改),即
参数
默认值
描述
eviction_target
80
当cache被使用量超过该阈值,后台驱逐线程开始将一些数据页从缓存中移除干净页
eviction_trigger
95
当cache被使用量超过该阈值,用户线程开始将一些数据页从缓存中移除干净页
eviction_dirty_target
5
当cache被使用量超过该阈值,后台驱逐线程开始将一些数据页从缓存中移除脏页
eviction_dirty_trigger
20
当cache被使用量超过该阈值,用户线程开始将一些数据页从缓存中移除脏页
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2022-02-07 数据泵在导入数据时为什么会大量使用undo
2017-02-07 12C配置EM Express的https端口
点击右上角即可分享
微信分享提示