When MongoDB eats all idle memory, server operations become slower and slower. Although it does not have much impact on MongoDB's read operations, the write performance is greatly reduced at this time (it is suspected that the memory is insufficient ). Due to the need to collect a large amount of historical file data, when multiple threads collect to a certain extent, the writing speed becomes slower and slower. After multiple tests, it is found that it is related to the service memory usage peak. When the server memory usage is low, multi-thread writing is faster. When the server memory is exhausted by MongoDB ing, the write speed of multi-thread writing is too slow to be miserable, this situation is obvious even in a single thread. Although MongoDB provides runcommnad( {closealldatabase: 1}) or disables the database to release the cache, this affects normal read/write operations. Therefore, reserving a certain amount of memory space for the server has become a solution to ensure fast writing. Of course, under normal circumstances, there will be no such frequency of file write operations, but the current situation is special, is to collect a large number of historical files. To verify this problem, we can use Windows system resource manager (wsrm) to runProgramMemory and CPU usage control (Windows2003/windows2008), here windows2008 is used, in the Control Manager panel add function select Windows system resource manager to install. For details, see the link for wsrm usage.