Too much memory is being used during backup I have mongodb in ubuntu server. DB version : 3.2.8

CPU : 4 Core

Memory : 16 GB

Disk : 50GB

Normally server memory status:



Running backup script:

DIR=`date +%m%d%y`
DEST=DBBackup/MongoDB/$DIR
mongodump -d onedb -o $DEST
mongodump -d twodb -o $DEST
mongodump -d threedb -o $DEST
mongodump -d fourdb -o $DEST
mongodump -d fivedb -o $DEST


Script finished and server memory status:



The cache remains the same. If I repeatedly a backup for five days, all memory will be used. The memory is not flush automatically. What should I do?
MongoDB will eventually use all free memory, always! Of course in the situation where data and it indexes are smaller than free memory, mongod cannot fill whole memory.

Now, when you do backups, mongod reads all needed data (for those backups) to the memory and let it (the data) be there as long as it has free space. When there is no free memory anymore and mongod need to read something that is not already in the memory, oldest data is thrown away.