How to release memory in mongodb

if mongodb has been used for a long time, the memory footprint will continue to rise. It is not good to shut down the database and release memory. Is there any better way to free the memory occupied by mongodb?

Mar.30,2021

the data in memory is all hot data. You free memory, although reducing memory footprint, but at the expense of a certain amount of access performance.
what needs to be done is performance optimization. Not just freeing up memory.
there are many ways to optimize. At the hardware level, you can add ssd, machine (sharding), memory, etc.; at the software level, you can analyze which are high-frequency access, which are bulk, and which are time-consuming operations. Treat them separately.

analyze the hardware performance first, and then analyze the mongo itself. There is no flat hammer.
mongo analysis tools are: mongostat , db.currentOP () , sh.status () , db.status () .

Menu