[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]调整mongodb的缓存大小

上一篇:[备忘]linux下mongodb安装
下一篇:[GDS]Sabre的PassengerDetailsRS,返回错误OTH RESTRICTIONS APPLY-BOOK OTH NO LATER THAN 31MAR

添加日期:2017/9/7 1:41:29 快速返回   返回列表 阅读2654次
https://docs.mongodb.com/manual/core/wiredtiger/

MongoDB3.2版本开始,默认存储引擎是WiredTiger。

(1)
-----------------------------
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.
-------------------------------
3.4版本开始,WiredTiger内部缓存默认使用(物理内存的一半减去1G),最小256MB。

它会一直吃内存,吃到限制为止。

(2)如何调整内存缓存
配置文件中使用
storage.wiredTiger.engineConfig.cacheSizeGB参数

或者启动命令里使用--wiredTigerCacheSizeGB参数

https://docs.mongodb.com/manual/reference/configuration-options/#storage.wiredTiger.engineConfig.cacheSizeGB

(3)配置文件写法


# Where and how to store data.
storage:
  dbPath: /data/db2
  journal:
    enabled: true
#  engine:
#  mmapv1:
  wiredTiger:
     engineConfig:
        cacheSizeGB: 2



注意每行前面的空格数量,注意对齐
我实际试的是:
wiredTiger前面有2个空格
engineConfig前面有5个空格
cacheSizeGB前面有8个空格

格式不对,启动不起来的哦~~

另外,内存不要调的太大,不要大于默认值(内存-1再除以2,比如16G内存,不要大于7.5G)
这个cacheSize只是mongo内部缓存(干啥用?)大小,
剩下的内存,操作系统会用来做文件缓存,把文件放内存里。
------------------------------
Avoid increasing the WiredTiger internal cache size above its default value.

With WiredTiger, MongoDB utilizes both the WiredTiger internal cache and the filesystem cache.

Via the filesystem cache, MongoDB automatically uses all free memory that is not used by the WiredTiger cache or by other processes.
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved