I am executing some benchmark using a DBMS and virtual machines. And I am using this command
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
on each Guest, and on each Host, before executing a query, to minimize the effect of cache/buffering on my execution time. If the data is cached/buffered the execution time for a query may vary depending on what query was executed before, because a part of the file used to answer the query might be in memory.
I saw this post: How do you empty the buffers and cache on a Linux system?
But for me it's a little tricky to execute sync/drop caches after each query. I need to ask for every VM and for every physical server to sync/drop caches. I could write a script, and use SSH to do this, but I wonder if there's a way to keep the OS from buffering/caching the files because it would be easier for me.
I am using Ubuntu 12.04 on all the VMs (using KVM) and servers.
sync
fixes the problem, then they aren't due to caching, but to buffering. – Gilles 'SO- stop being evil' Oct 15 '14 at 23:16I don't actually get strange results. The results I am getting are expected, but I want to minimize the effect of caching/buffering the file system data. I am using KVM as my hypervisor. Both guests and hosts are using ubuntu server.
– hlustosa Oct 16 '14 at 08:45