如何配置 Mongodb 的缓存大小?

2023-12-20

我需要在 Mongodb 中处理缓存。这样做需要大量 RAM 吗? 在这种情况下使用存储引擎有什么特点和优势?


  1. 方法(重启后无效):

    ./bin/mongo 管理员

    db.adminCommand( { "setParameter": 1, "wiredTigerEngineRuntimeConfig": "cache_size=10G"})

  2. 启动 mongodb 服务

    ./bin/mongod --config server.conf --wiredTigerCacheSizeGB=10

--- server.conf(每行一个键/值)---

maxConns=200
logpath=logs/server.log
logappend=true
fork=true
dbpath=data
nohttpinterface=true
syncdelay=60
quiet = true
slowms = 2000
notablescan = false

使用以下命令检查大小:

> db.serverStatus().wiredTiger.cache
{
        "bytes currently in the cache" : 4606522365,
        "bytes read into cache" : 3291056,
        "bytes written from cache" : 5631783282,
        "checkpoint blocked page eviction" : 0,
        "eviction currently operating in aggressive mode" : 0,
        "eviction server candidate queue empty when topping up" : 448,
        "eviction server candidate queue not empty when topping up" : 0,
        "eviction server evicting pages" : 0,
        "eviction server populating queue, but not evicting pages" : 447,
        "eviction server unable to reach eviction goal" : 0,
        "eviction worker thread evicting pages" : 12,
        "failed eviction of pages that exceeded the in-memory maximum" : 0,
        "files with active eviction walks" : 0,
        "files with new eviction walks started" : 105,
        "hazard pointer blocked page eviction" : 0,
        "in-memory page passed criteria to be split" : 896,
        "in-memory page splits" : 448,
        "internal pages evicted" : 0,
        "internal pages split during eviction" : 0,
        "leaf pages split during eviction" : 13,
        "lookaside table insert calls" : 0,
        "lookaside table remove calls" : 0,
        "maximum bytes configured" : 10737418240,  <---- this is the configured size
        "maximum page size at eviction" : 8388576,
        "modified pages evicted" : 13,
        "modified pages evicted by application threads" : 0,
        "page split during eviction deepened the tree" : 0,
        "page written requiring lookaside records" : 0,
        "pages currently held in the cache" : 675,
        "pages evicted because they exceeded the in-memory maximum" : 1,
        "pages evicted because they had chains of deleted items" : 448,
        "pages evicted by application threads" : 0,
        "pages queued for eviction" : 12,
        "pages queued for urgent eviction" : 0,
        "pages read into cache" : 234,
        "pages read into cache requiring lookaside entries" : 0,
        "pages seen by eviction walk" : 25702,
        "pages selected for eviction unable to be evicted" : 0,
        "pages walked for eviction" : 127975,
        "pages written from cache" : 310352,
        "pages written requiring in-memory restoration" : 0,
        "percentage overhead" : 8,
        "tracked bytes belonging to internal pages in the cache" : 316858,
        "tracked bytes belonging to leaf pages in the cache" : 4606205507,
        "tracked bytes belonging to overflow pages in the cache" : 0,
        "tracked dirty bytes in the cache" : 809239633,
        "tracked dirty pages in the cache" : 190,
        "unmodified pages evicted" : 0
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何配置 Mongodb 的缓存大小? 的相关文章

  • 如何在 Mongo 聚合管道的 $unwind 阶段保留零长度值?

    我正在使用聚合管道编写 Mongo 查询 在聚合过程中 我需要 unwind领域之一 但是 我不想要 unwind排除该字段具有零长度数组的条目 因为我仍然需要它们进一步深入管道 我的领域叫做items它是一个对象数组 每个对象包含两个值
  • 将 MongoDb 同步到 ElasticSearch

    我正在寻找一种将 MongoDB 中的集合与 Elastic Search ES 同步的方法 目标是以 MongoDB 作为主要数据源 并使用 MongoDB 作为全文搜索引擎 我的项目的业务逻辑是用python写的 网上有多种方法可供选择
  • Morphia - 未在 dbObj 中找到定义的类

    我有一个相当有趣的问题 当尝试从 Mongo 实例加载模型时 Morphia 会抛出以下错误 22 17 13 WARN Class not found defined in dbObj java lang ClassNotFoundExc
  • 猫鼬模式创建

    我刚刚开始使用猫鼬 我有一个使用 mongoose 的创建脚本 它使用示例数据创建模式和数据库 现在我编写实际的应用程序 我是否需要在每次应用程序运行时创建架构对象 或者它是否已经以某种方式可用 换句话说 我是否需要在每个使用 mongoo
  • MongoDB 删除 MapReduce 集合

    由于客户端代码中的错误 mongodb 创建了许多 mr mapreduce 集合 如何将它们全部删除 可能通过掩码 我在交互式 shell 中运行脚本 function f var names db getCollectionNames
  • 如何在 mongodb 查询中过滤数组

    在 mongodb 中 我有一个包含单个文档的集合 如下所示 id ObjectId 5552b7fd9e8c7572e36e39df StackSummaries StackId arn aws cloudformation ap sou
  • 使用 MongoDB 和 ASP.NET MVC 进行分页的有效方法

    我们正在创建一个应用程序 MongoDB 作为数据库 我们正在使用MongoDB 的官方 C 驱动程序 http docs mongodb org ecosystem drivers csharp 我们有一个包含数千条记录的集合 我们想要创
  • 正则表达式 Spring 数据 mongodb 存储库

    早上好 我正在尝试使用查询注释将正则表达式与 Spring data mongodb 存储库结合起来 我想要的是在我的 mongo 文档的一个字符串属性中搜索一个子字符串 我一直在谷歌和这里寻找 但我没有找到任何优雅的东西 我想知道 Spr
  • Spring Mongo Populator 一一

    我在 Kotlin 上使用 MongoDB 和 Spring 并且希望我的应用程序在启动时填充 MongoDB 集合 并在每次启动时清理 我的问题是 如果我填充的某些数据有问题 如何才能一一填充数据以便容错 my code Configur
  • Spring mongodb 指南针缺少创建的数据/集合

    我使用 spring 将数据保存到数据库 RepositoryRestResource collectionResourceRel operators path operators public interface OperatorsRep
  • 如何减少嵌套文档聚合管道中的展开阶段?

    我是 mongodb 新手 正在尝试使用嵌套文档 我有一个查询如下 db EndpointData aggregate group id EndpointId RequestCount sum 1 FirstActivity min Dat
  • Mongoose 模型 update() 与 save()

    有一个关于问题update vs save https stackoverflow com questions 39010045 mongoose update vs save 但它针对的是一些不同的东西 我猜 纯粹相关mongoose S
  • 如何在没有objectid字段的mongodb集合上查找上次更新/插入/删除操作时间

    我在 MongoDb 数据库中有一些未使用的集合 我必须找出对数据库中的集合执行 CRUD 操作的时间 我们有自己的 id字段 而不是mongo默认的object id 我们没有任何时间在集合中归档以找出修改时间 有没有办法从元数据中找出m
  • 如何使用 pymongo 在 mongodb 中查询日期?

    我试图在 mongodb 中执行查询日期 但结果始终为空 我的查询如下 in the begin code def init self self now datetime now self db conexaoMongo self hora
  • 无法连接到服务器 127.0.0.1:27017 连接尝试失败 MongoDB

    我正在使用 Ubuntu 操作系统 16 04 我正在使用命令启动 mongodb sudo service mongod start进而mongo 它为我生成了这个错误 MongoDB shell version v4 0 1 conne
  • PHP 中的 MongoDB - 如何将项目插入集合中的数组中?

    这必须很容易 但我似乎无法弄清楚 假设我有一个集合users这是集合中的第一项 id ObjectId 4d8653c027d02a6437bc89ca name Oscar Godson email email protected cdn
  • 为 Meteor 数据创建编号列表

    有没有办法获取 Meteor 集合中项目的编号列表的 编号 我知道我可以在 html 中做到这一点 但我觉得如果我可以在 spacebars 中放置一些东西 那么样式会更容易 如果我可以使用更好的术语 请告诉我 像这样的东西 前 20 部电
  • Pymongo 批量插入

    我正在尝试批量插入文档 但批量插入时不会插入超过 84 个文档 给我这个错误 in insert pymongo errors InvalidOperation cannot do an empty bulk insert 是否可以批量插入
  • Node.js 检测两个猫鼬查找何时完成

    我正在尝试使用自动完成功能初始化两个输入library https www devbridge com sourcery components jquery autocomplete 当我加载页面时 我将触发 Ajax 来初始化两个输入文本
  • 获取对象数组中每个嵌套对象的虚拟属性?

    所以我知道如何获取单个虚拟属性 如 Mongoose 文档中所述 PersonSchema virtual name full get function return this name first this name last 但如果我的

随机推荐