Gradually insert data into mongodb, and when a data is inserted, it will not be moved.
However, despite the increase in running time, I found that 1G+ of my small 8G memory was occupied by mongo.
As time goes on, there is still an increasing trend.
Mongo has been set as a service by me. After closing the program, mongo process still takes up 1G+ of memory.
There are three questions I would like to ask:
1. I remember the document said that mongo will automatically transfer some data to the hard disk. May I know when the transfer took place?
2. After closing the program, the writing operation to mongo has been stopped. How to free up the space occupied in the memory and ensure that it has been transferred to the hard disk?
3. If I don’t close the program, will the memory be gradually occupied until it is completely consumed? If so, how to limit its memory usage under windows environment? After checking this question, most of them said that ulimit is linux, right?
- Memory will be released after mongodb is shut down. Verify that there is something wrong with your service that has failed to shut down the mongodb process.
- Confirm your mongodb version number, some versions of mongodb 3.0 have memory leak bugs, and the versions after mongodb 3.0.10 and 3.2.4 have been fixed. Please confirm whether the version with bugs has been used, and if so, try to upgrade.
Finally, the official FAQ on memory usage is:https://docs.mongodb.com/manu …
MongoDB’s Wiredtiger storage engine version 3.4 (introduced version 2.8, default version 3.2) uses the following memory:
Starting in 3.4, the WiredTiger internal cache, by default, will use the larger of either:
- 50% of RAM minus 1 GB, or
- 256 MB.
In other words, WT engine will use up to 50% of the memory as cache by default, so your memory usage is absolutely no problem. If you want to limit the memory size of cache, you can configure itstorage.wiredTiger.engineConfig.cacheSizeGBAttribute