Question

I want to benchmark some Mongodb queries by calculating their execution time but I could not find a way to do so without caching : The first time I execute a query it takes a decent amount of time and the second time I execute the same query it is extremely faster which means it was due to caching.

I tried clearing linux cache : echo 3 > /proc/sys/vm/drop_caches and also Mongodb plan cache clearing db..getPlanCache().clear() but it didn't solve the problem.

Are there any way to always measure a query execution duration as if it is executed for the first time ?

Was it helpful?

Solution

Profiling with level 2 stores needed information.

If you reboot mongod process and drop linux caches, it will empty all used caches.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top