recently i'm working on mongo db and I'm trying to check the performance of mongodb with 2 million record. I need to clear cache every time I start the test. I don't want to restart the computer/server each time I want to run the test. I tried to clear collections cache but the result wasn't as I expected. Is there a way to clear cache like the way exist in linux ?

1 Answer 1

  1. stop mongod

  2. sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

  3. start mongod

stop mongod: Stops the database service. sh -c "sync; echo 3 > /proc/sys/vm/drop_caches": write any data stored in memory to disk. start mongod: Start the database again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.