我的蒙神命令
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-bionic码头图像。
发布于 2021-07-02 02:48:11
最大的缓存大小就是--对底层存储引擎使用的缓存大小的限制。
如果您运行查询、排序、建立连接等,这些都需要缓存之外的内存。
MongoDB使用tcmalloc进行内存管理,它不会在程序调用free时立即将内存释放回操作系统。
您可以通过添加以下tcmallocAggressiveMemoryDecommit服务器参数来调整tcmalloc释放内存的方式:https://jira.mongodb.org/browse/SERVER-16829
https://dba.stackexchange.com/questions/295048
复制相似问题