MongDB 内存消耗高于wiredTigercacheSizeGB 中设置的值

问题描述

您好专家

我使用以下命令在我的 2GB ec2 实例上运行了一个 mongodb 服务器

mongod --wiredTigerCacheSizeGB=0.5

以下是我的内存使用情况:

------------------------------------------------
MALLOC:      509658616 (  486.0 MiB) Bytes in use by application
MALLOC: +    100265984 (   95.6 MiB) Bytes in page heap freelist
MALLOC: +     10784344 (   10.3 MiB) Bytes in central cache freelist
MALLOC: +      8235328 (    7.9 MiB) Bytes in transfer cache freelist
MALLOC: +      3289712 (    3.1 MiB) Bytes in thread cache freelists
MALLOC: +      4063232 (    3.9 MiB) Bytes in malloc Metadata
MALLOC:   ------------
MALLOC: =    636297216 (  606.8 MiB) Actual memory used (physical + swap)
MALLOC: +       385024 (    0.4 MiB) Bytes released to OS (aka unmapped)
MALLOC:   ------------
MALLOC: =    636682240 (  607.2 MiB) Virtual address space used
MALLOC:
MALLOC:          23555              Spans in use
MALLOC:             26              Thread heaps in use
MALLOC:           4096              tcmalloc page size
------------------------------------------------

据我了解使用的虚拟地址空间是Mongodb占用的总内存。 如果有人能告诉我为什么它增加到 0.5(500MB) 的限制集以上,那将会很有帮助

----------------More  Info--------------------
{
    "name" : "wiredTiger","supportsCommittedReads" : true,"oldestrequiredTimestampForCrashRecovery" : Timestamp(0,0),"supportsPendingDrops" : true,"dropPendingIdents" : NumberLong(0),"supportsSnapshotReadConcern" : true,"readOnly" : false,"persistent" : true,"backupCursorOpen" : false
}

{
    "db" : "Database","collections" : 43,"views" : 0,"objects" : 2780441,"avgobjSize" : 2756.87204116182,"dataSize" : 7665320055.0,"storageSize" : 2320449536.0,"numExtents" : 0,"indexes" : 58,"indexSize" : 156573696.0,"scaleFactor" : 1.0,"fsUsedSize" : 77780537344.0,"fsTotalSize" : 214746263552.0,"ok" : 1.0
}

MongDB 内存消耗高于wiredTigercacheSizeGB 中的设置值

解决方法

Wired Tiger 是 MongoDB 的一个组件。还有许多其他组件。预计整个服务器的内存使用量将大于对服务器一个组件的某一方面施加的限制。