MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

MongoDB using almost 50% memory usage

Hello Experts,
I am beginner to operate MongoDB and I have big challenge to handle/control host memory usage.
I run 3 replica mongoDB environment, each server has 125GB memory and 2 of them were using almost 50% of system memory which is almost 60GB out of 125GB. And I have no idea how to control the memory usage under 10GB.
So I am absolutely looking for somebody who can advise on above matter.

Will stay tuned and thanks in advance to whom give support on this matter.

See: https://docs.mongodb.com/manual/core/wiredtiger/#memory-use

With WiredTiger, MongoDB utilizes both the WiredTiger internal cache and the filesystem cache.

Starting in MongoDB 3.4, the default WiredTiger internal cache size is the larger of either:

50% of (RAM - 1 GB), or
256 MB.

Via the filesystem cache, MongoDB automatically uses all free memory that is not used by the WiredTiger cache or by other processes.

You can limit the size of WiredTiger internal cache by setting up storage.wiredTiger.cacheSizeGB parameter during mongod startup or in configuration file. Below is the snippet of a configuration file used in one of my deployment where i limit the internal cache to 8GB.

storage:
  dbPath: /ebs01/mongo/data/
  engine: wiredTiger
  directoryPerDB: true
  wiredTiger:
    engineConfig:
       cacheSizeGB: 8
       directoryForIndexes: true

Hope this helps.

Regards,
E