mongodb分配内存
环境:
Os:Centos 7
mongodb:4.4.22
配置文件设置的内存大小
[root@localhost conf]# more mongo.cnf
net:
bindIp: 192.168.1.108,127.0.0.1
port: 28001
storage:
journal:
enabled: true
dbPath: "/home/middle/mongodb/data"
engine: wiredTiger
wiredTiger:
engineConfig:
cacheSizeGB: 1
systemLog:
destination: file
path: "/home/middle/mongodb/log/mongodb.log"
logAppend: true
logRotate: reopen
processManagement:
fork: true
pidFilePath: "/home/middle/mongodb/run/28001.pid"
security:
authorization: "enabled"
=格式的配置文件,设置内存大小是如下参数:
wiredTigerCacheSizeGB=1
查看运行情况
> db.serverStatus().wiredTiger.cache
{
"application threads page read from disk to cache count" : 8,
"application threads page read from disk to cache time (usecs)" : 38,
"application threads page write from cache to disk count" : 78,
"application threads page write from cache to disk time (usecs)" : 3988,
"bytes allocated for updates" : 19962,
"bytes belonging to page images in the cache" : 33361,
"bytes belonging to the history store table in the cache" : 571,
"bytes currently in the cache" : 59384,
"bytes dirty in the cache cumulative" : 1182376,
"bytes not belonging to page images in the cache" : 26023,
"bytes read into cache" : 30890,
"bytes written from cache" : 813237,
"cache overflow score" : 0,
"checkpoint blocked page eviction" : 0,
"checkpoint of history store file blocked non-history store page eviction" : 0,
"eviction calls to get a page" : 0,
"eviction calls to get a page found queue empty" : 0,
"eviction calls to get a page found queue empty after locking" : 0,
"eviction currently operating in aggressive mode" : 0,
"eviction empty score" : 0,
"eviction gave up due to detecting an out of order on disk value behind the last update on the chain" : 0,
"eviction gave up due to detecting an out of order tombstone ahead of the selected on disk update" : 0,
"eviction gave up due to detecting an out of order tombstone ahead of the selected on disk update after validating the update chain" : 0,
"eviction gave up due to detecting out of order timestamps on the update chain after the selected on disk update" : 0,
"eviction passes of a file" : 0,
"eviction server candidate queue empty when topping up" : 0,
"eviction server candidate queue not empty when topping up" : 0,
"eviction server evicting pages" : 0,
"eviction server slept, because we did not make progress with eviction" : 0,
"eviction server unable to reach eviction goal" : 0,
"eviction server waiting for a leaf page" : 1,
"eviction state" : 64,
"eviction walk most recent sleeps for checkpoint handle gathering" : 0,
"eviction walk target pages histogram - 0-9" : 0,
"eviction walk target pages histogram - 10-31" : 0,
"eviction walk target pages histogram - 128 and higher" : 0,
"eviction walk target pages histogram - 32-63" : 0,
"eviction walk target pages histogram - 64-128" : 0,
"eviction walk target pages reduced due to history store cache pressure" : 0,
"eviction walk target strategy both clean and dirty pages" : 0,
"eviction walk target strategy only clean pages" : 0,
"eviction walk target strategy only dirty pages" : 0,
"eviction walks abandoned" : 0,
"eviction walks gave up because they restarted their walk twice" : 0,
"eviction walks gave up because they saw too many pages and found no candidates" : 0,
"eviction walks gave up because they saw too many pages and found too few candidates" : 0,
"eviction walks reached end of tree" : 0,
"eviction walks restarted" : 0,
"eviction walks started from root of tree" : 0,
"eviction walks started from saved location in tree" : 0,
"eviction worker thread active" : 4,
"eviction worker thread created" : 0,
"eviction worker thread evicting pages" : 0,
"eviction worker thread removed" : 0,
"eviction worker thread stable number" : 0,
"files with active eviction walks" : 0,
"files with new eviction walks started" : 0,
"force re-tuning of eviction workers once in a while" : 0,
"forced eviction - history store pages failed to evict while session has history store cursor open" : 0,
"forced eviction - history store pages selected while session has history store cursor open" : 0,
"forced eviction - history store pages successfully evicted while session has history store cursor open" : 0,
"forced eviction - pages evicted that were clean count" : 0,
"forced eviction - pages evicted that were clean time (usecs)" : 0,
"forced eviction - pages evicted that were dirty count" : 0,
"forced eviction - pages evicted that were dirty time (usecs)" : 0,
"forced eviction - pages selected because of a large number of updates to a single item" : 0,
"forced eviction - pages selected because of too many deleted items count" : 0,
"forced eviction - pages selected count" : 0,
"forced eviction - pages selected unable to be evicted count" : 0,
"forced eviction - pages selected unable to be evicted time" : 0,
"hazard pointer blocked page eviction" : 0,
"hazard pointer check calls" : 0,
"hazard pointer check entries walked" : 0,
"hazard pointer maximum array length" : 0,
"history store score" : 0,
"history store table insert calls" : 0,
"history store table insert calls that returned restart" : 0,
"history store table max on-disk size" : 0,
"history store table on-disk size" : 4096,
"history store table out-of-order resolved updates that lose their durable timestamp" : 0,
"history store table out-of-order updates that were fixed up by reinserting with the fixed timestamp" : 0,
"history store table reads" : 0,
"history store table reads missed" : 0,
"history store table reads requiring squashed modifies" : 0,
"history store table truncation by rollback to stable to remove an unstable update" : 0,
"history store table truncation by rollback to stable to remove an update" : 0,
"history store table truncation to remove an update" : 0,
"history store table truncation to remove range of updates due to key being removed from the data page during reconciliation" : 0,
"history store table truncation to remove range of updates due to out-of-order timestamp update on data page" : 0,
"history store table writes requiring squashed modifies" : 0,
"in-memory page passed criteria to be split" : 0,
"in-memory page splits" : 0,
"internal pages evicted" : 0,
"internal pages queued for eviction" : 0,
"internal pages seen by eviction walk" : 0,
"internal pages seen by eviction walk that are already queued" : 0,
"internal pages split during eviction" : 0,
"leaf pages split during eviction" : 0,
"maximum bytes configured" : 1073741824,
"maximum page size at eviction" : 0,
"modified pages evicted" : 0,
"modified pages evicted by application threads" : 0,
"operations timed out waiting for space in cache" : 0,
"overflow pages read into cache" : 0,
"page split during eviction deepened the tree" : 0,
"page written requiring history store records" : 0,
"pages currently held in the cache" : 26,
"pages evicted by application threads" : 0,
"pages evicted in parallel with checkpoint" : 0,
"pages queued for eviction" : 0,
"pages queued for eviction post lru sorting" : 0,
"pages queued for urgent eviction" : 0,
"pages queued for urgent eviction during walk" : 0,
"pages queued for urgent eviction from history store due to high dirty content" : 0,
"pages read into cache" : 18,
"pages read into cache after truncate" : 4,
"pages read into cache after truncate in prepare state" : 0,
"pages requested from the cache" : 1067,
"pages seen by eviction walk" : 0,
"pages seen by eviction walk that are already queued" : 0,
"pages selected for eviction unable to be evicted" : 0,
"pages selected for eviction unable to be evicted as the parent page has overflow items" : 0,
"pages selected for eviction unable to be evicted because of active children on an internal page" : 0,
"pages selected for eviction unable to be evicted because of failure in reconciliation" : 0,
"pages selected for eviction unable to be evicted because of race between checkpoint and out of order timestamps handling" : 0,
"pages walked for eviction" : 0,
"pages written from cache" : 80,
"pages written requiring in-memory restoration" : 0,
"percentage overhead" : 8,
"the number of times full update inserted to history store" : 0,
"the number of times reverse modify inserted to history store" : 0,
"tracked bytes belonging to internal pages in the cache" : 4848,
"tracked bytes belonging to leaf pages in the cache" : 54536,
"tracked dirty bytes in the cache" : 0,
"tracked dirty pages in the cache" : 0,
"unmodified pages evicted" : 0
}