Hi,
Memory usage of one of the secondary members has slowly grown and reached up to 75%. This triggers continuous alerts from the monitoring system used to monitor the replica set deployment.
Could you post more details about your deployment:
db.serverCmdLineOpts()
of all three nodes.rs.printSlaveReplicationInfo()
Will the mongod process go out of memory if the memory usage keeps growing gradually?
It is a possibility, however unless your provision a server with very small amount of memory (e.g. 1 GB or less), that should not happen. Typically, this situation manifests in the MongoDB process getting killed by Linux OOM killer.
Why does it use 75% of memory for relatively small size of data?
Secondary reads, running a large aggregation, or index building are some of the possible explanation, however it’s impossible to tell what’s going on in your server unless you post more detailed observation and data. The set of questions above should provide a starting point.
Why doesn’t wiredTiger releases memory when other operations are being performed?
There are two types of cache used by MongoDB using the WiredTiger storage engine:
By default, WiredTiger will try to keep its cache usage to 80%, and the output of mongostat
you posted seems to indicate that it’s at 73.6%, well below the 80% ceiling.
What is the best solution or workaround to mitigate the high memory usage?
MongoDB was designed to use the most amount of memory that is available to ensure it gives the best performance with regard to your hardware. Therefore, currently there is no built-in method to limit MongoDB memory usage.
Also, I would recommend you to upgrade to the latest version in the 3.2 series, which is currently 3.2.10. MongoDB 3.2.10 contains many improvements regarding the WiredTiger cache.
Best regards,
Kevin
Hi Kevin,