Flushing the Linux System Cache

Found this interesting page on the Linux memory management site which details how to clear the system cache in Linux. This was handy for us as we were testing file download performance off various VPS configurations and we wanted to be sure the file we were downloading was getting read off the disk, so we could more accurately measure the usual performance.

Basically you can just do: echo 3 > /proc/sys/vm/drop_caches and it will ‘free pagecache, dentries and inodes’. This worked a treat; we were able to download a file, then download it again (observing that the second download was much, much faster because it was coming out of the system cache), then run that echo and download again and observe that the speeds were back to the first download.

Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.