如何配置Mongodb的缓存大小?

如何配置Mongodb的缓存大小?,mongodb,mmap,Mongodb,Mmap,我需要在Mongodb中处理现金。这样做需要大量RAM吗? 在这种情况下,使用存储引擎有哪些特点和优势 Dba是合适的位置。如果您正在使用WiredTiger,使用所有可用的RAM和动态资源调配,则缓存已经定义。Dba是合适的位置。如果您正在使用WiredTiger,使用所有可用的RAM和动态资源调配,则缓存已经定义 方法(无法在重新启动后继续): /bin/mongo管理员 adminCommand({“setParameter”:1,“wiredTigerEngineRuntimeConfi

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

Dba是合适的位置。如果您正在使用WiredTiger,使用所有可用的RAM和动态资源调配,则缓存已经定义。

Dba是合适的位置。如果您正在使用WiredTiger,使用所有可用的RAM和动态资源调配,则缓存已经定义

  • 方法(无法在重新启动后继续):

    /bin/mongo管理员

    adminCommand({“setParameter”:1,“wiredTigerEngineRuntimeConfig”:“cache_size=10G”})

  • 开始mongodb服务

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

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

    使用此命令检查大小:

    > 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
    }
    
    >db.serverStatus().wiredTiger.cache
    {
    “缓存中当前的字节数”:4606522365,
    “读取到缓存中的字节”:3291056,
    “从缓存写入的字节”:5631783282,
    “检查点阻止的页面逐出”:0,
    “当前正在攻击模式下运行的逐出”:0,
    “加满时逐出服务器候选队列为空”:448,
    “加满时逐出服务器候选队列不为空”:0,
    “逐出服务器逐出页面”:0,
    “逐出服务器填充队列,但不逐出页面”:447,
    “逐出服务器无法达到逐出目标”:0,
    “逐出工作线程逐出页面”:12,
    “退出超过内存最大值的页面失败”:0,
    “具有活动逐出遍历的文件”:0,
    “已开始执行新的驱逐程序的文件”:105,
    “危险指针阻止页面逐出”:0,
    “内存中已通过要拆分的条件的页”:896,
    “内存页拆分”:448,
    “内部页面被逐出”:0,
    “逐出期间拆分的内部页面”:0,
    “驱逐期间拆分的页面”:13,
    “lookaside表插入调用”:0,
    “lookaside表删除调用”:0,
    “配置的最大字节数”:10737418240,
    
  • 方法(无法在重新启动后继续):

    /bin/mongo管理员

    adminCommand({“setParameter”:1,“wiredTigerEngineRuntimeConfig”:“cache_size=10G”})

  • 开始mongodb服务

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

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

    使用此命令检查大小:

    > 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
    }
    
    >db.serverStatus().wiredTiger.cache
    {
    “缓存中当前的字节数”:4606522365,
    “读取到缓存中的字节”:3291056,
    “从缓存写入的字节”:5631783282,
    “检查点阻止的页面逐出”:0,
    “当前正在攻击模式下运行的逐出”:0,
    “加满时逐出服务器候选队列为空”:448,
    “加满时逐出服务器候选队列不为空”:0,
    “逐出服务器逐出页面”:0,
    “逐出服务器填充队列,但不逐出页面”:447,
    “逐出服务器无法达到逐出目标”:0,
    “逐出工作线程逐出页面”:12,
    “退出超过内存最大值的页面失败”:0,
    “具有活动逐出遍历的文件”:0,
    “已开始执行新的驱逐程序的文件”:105,
    “危险指针阻止页面逐出”:0,
    “内存中已通过要拆分的条件的页”:896,
    “内存页拆分”:448,
    “内部页面被逐出”:0,
    “逐出期间拆分的内部页面”:0,
    “驱逐期间拆分的页面”:13,
    “lookaside表插入调用”:0,
    “lookaside表删除调用”:0,
    
    “配置的最大字节数”:10737418240,更简洁的WT缓存大小输出(GB):

    db.serverStatus().wiredTiger.cache[“配置的最大字节数”]/1024/1024/1024
    64

    以GB为单位的WT缓存大小的更简洁输出是:

    db.serverStatus().wiredTiger.cache[“配置的最大字节数”]/1024/1024/1024
    64

    StackOverflow用于基于编程的问题,而不是此问题。这与数据库配置相关,应改为发布在上。确定删除此问题,是否应将其删除?@BlakesSevenStackOverflow用于基于编程的问题,而不是此问题。这与数据库配置相关,应进行说明ead将被发布。好的,删除那里的问题,我应该删除它吗?@BlakesSevenLittle位解释或参考欢迎@RicardoIt的mongod设置,同时启动服务器。这里有一个提示(关于缓存主题):。如果您不熟悉WiredTiger,我强烈建议您阅读他们的文档。关于MMAPV1呢?我很熟悉。如何使用它配置现金@Ricardo@IstiakMorsalinMMAPV1可能很快就会转向传统系统。在他们的研究中,他们指出了这一点,特别是考虑到他们收购了该公司(WiredTiger)。在启动服务器时,欢迎对@RicardoIt's a mongod设置进行一些解释或参考。这里有一个技巧(关于缓存的主题):。如果您不熟悉WiredTiger,我强烈建议您阅读他们的文档。关于MMAPV1呢?我很熟悉。如何使用它配置现金@Ricardo@IstiakMorsalinMMAPV1可能很快就会转向传统系统。在他们的研究中,他们指出了这一点,特别是考虑到他们收购了该公司(WiredTiger)。