Clearing cache for performance testing in MongoDB?
I know that when testing query performance on relational databases, you usually clear the cache before running the query to get a real idea of ββwhat the performance will be like when you first query the data. Is there something like this in MongoDB?
I found some item to clear the query plan cache , but nothing that could clear the cached data. Is there such a thing in MongoDB? If so, can someone point me to some documentation?
source to share
This solution assumes you are on a Unix-like system.
I haven't done much DBA MongoDB, but I believe this video contains an answer to clearing cached data.
Relevant part of the video that goes 4:57 in the video and the command:
sudo echo 1 > /proc/sys/vm/drop_caches
As the video explains, usage 1
should be sufficient for most cases, but if you want to make absolutely sure you can use 3
. And if you (eg instructor from MongoDB class ) find this command "inelegant", you can use:
sudo sysctl -w vm.drop_caches=1
There are other videos in this lecture series that introduce and demonstrate "pre- heating data " to get a working set in memory before your application accesses the machine so that users don't experience poor disk read performance.
source to share