AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题 / 295048
Accepted
Mugen
Mugen
Asked: 2021-07-01 05:16:39 +0800 CST2021-07-01 05:16:39 +0800 CST 2021-07-01 05:16:39 +0800 CST

了解为什么 MongoDB 使用的 RAM 比允许的wiredTigerCacheSizeGB 多

  • 772

我的 mongod 命令

mongod --wiredTigerCacheSizeGB 5

在实践中,我让 mongo 实例使用甚至高达 8.6 GB(在具有 50 GB RAM 的 VM 上)

索引使用大约 100 MB(用 选中db.stats())

tcmalloc 信息:

MALLOC:     3776745552 ( 3601.8 MiB) Bytes in use by application
MALLOC: +   4744544256 ( 4524.8 MiB) Bytes in page heap freelist
MALLOC: +     20067616 (   19.1 MiB) Bytes in central cache freelist
MALLOC: +      3584128 (    3.4 MiB) Bytes in transfer cache freelist
MALLOC: +     12470800 (   11.9 MiB) Bytes in thread cache freelists
MALLOC: +     22544384 (   21.5 MiB) Bytes in malloc metadata
MALLOC:   ------------
MALLOC: =   8579956736 ( 8182.5 MiB) Actual memory used (physical + swap)
MALLOC: +     29933568 (   28.5 MiB) Bytes released to OS (aka unmapped)
MALLOC:   ------------
MALLOC: =   8609890304 ( 8211.0 MiB) Virtual address space used
MALLOC:
MALLOC:          21650              Spans in use
MALLOC:             59              Thread heaps in use
MALLOC:           4096              Tcmalloc page size

服务器已经运行了 3 天。

我怎么知道为什么 mongo 消耗的内存超过了允许的缓存大小?有没有办法手动释放“页堆空闲列表”?

命令输出是推荐的Call ReleaseFreeMemory() to release freelist memory to the OS,但我认为我实际上不能在这个过程之外做到这一点。

MongoDB 版本是4.4.1,我使用的是mongo:4.4.1-bionicdocker 镜像。

mongodb memory
  • 1 1 个回答
  • 1344 Views

1 个回答

  • Voted
  1. Best Answer
    Joe
    2021-07-02T18:48:11+08:002021-07-02T18:48:11+08:00

    最大缓存大小就是这样 - 对底层存储引擎使用的缓存大小的限制。

    如果您运行查询、排序、建立连接等,这些都需要缓存之外的内存。

    MongoDB 使用 tcmalloc 进行内存管理,当程序调用free.

    tcmallocAggressiveMemoryDecommit您可以使用此处添加的服务器参数 调整 tcmalloc 释放内存的方式: https ://jira.mongodb.org/browse/SERVER-16829

    • 2

相关问题

  • 分片对小集合有效吗?

  • SQL Server 日志中没有“使用锁定页作为缓冲池”

  • 我正在使用 MEMORY 存储引擎,但 MySQL 仍然写入我的磁盘...为什么?

  • PostgreSQL:强制数据进入内存

  • 关于操作/管理 MongoDB 的良好资源

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve