Re: Clearing filesystem cache. How?
From: Jeroen Geilman (nospam_at_notadaptr.nl)
Date: 09/18/03
- Next message: Jeroen Geilman: "Re: Clearing filesystem cache. How?"
- Previous message: Michael Powe: "Re: [OT] Not - Re: Searching program to swith to console from X"
- In reply to: Nils Petter Vaskinn: "Clearing filesystem cache. How?"
- Next in thread: Menno Duursma: "Re: Clearing filesystem cache. How?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 18 Sep 2003 17:20:06 +0000
Nils Petter Vaskinn wrote:
> Hi all.
>
> I need to measure performance on a program. This program reads various
> files and to get a measurement as close to the real usage I need to make
> sure that those files are read from disk, and not from the filesystem
> cache.
Then do the obvious - write a benchmark that does just that !
Make the benchmark read so many files that you *know* they will be coming
from disk; after you've read up to $mem_size files worth of data the cache
will not be a factor...
> Is there any (easy) way to clear the filesystems buffer/cache (short of
> reading random junk into memory to fill the buffers with something else) ?
Loading garbage is next to useless, since Linux' disk cache is dynamic and
will grow to fill all available RAM - you'd have to reclaim all memory, but
that will cause swapping, rendering your benchmarks useless...
Don't know about easy...but you (or someone you know) could write a tiny C
program to mark all pages dirty and force a flush of the entire disk cache.
This would have to be a near-atomic operation, though - you have to make
sure nothing happens in between.
Just making the benchmark read so much data that you know it has to come
straight from disk is obviously the easiest way.
Really.
-- Jeroen Geilman Gentoo 1.4 rc4
- Next message: Jeroen Geilman: "Re: Clearing filesystem cache. How?"
- Previous message: Michael Powe: "Re: [OT] Not - Re: Searching program to swith to console from X"
- In reply to: Nils Petter Vaskinn: "Clearing filesystem cache. How?"
- Next in thread: Menno Duursma: "Re: Clearing filesystem cache. How?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|