On Tue, Jul 03, 2018 at 09:42:46AM +0200, Maximilian Pichler wrote:
> I'm doing some performance tests that include reading files from disk
> and want to make sure that each test takes place under similar
> conditions.
>
> In particular, how can one clear the disk cache? (I want to make sure
> that the second test isn't faster than the first one, just because
> some files they both use are still in cache.)
>
> Right now I'm doing:
> $ cat some_file_the_size_of_RAM > /dev/null
>
> Does this indeed clear the cache? Is there a better way?
>
> Also, are there several level of file/disk caches or just one?
>
> As always, thanks for your advice!
>
This will not clear the cache. Either run the test multiple times and
remove the first run or reboot the system after every run.
The buffer cache is implemented as two 2-queue and therefor a simple cat
bigfile will not fill the cache. You would need to read the file multiple
times and even then you may not manage.
--
:wq Claudio
No comments:
Post a Comment