1836442 Members
3448 Online
110100 Solutions
New Discussion

Re: Refresh buffer cache

 
Maurizio Fulli
Advisor

Refresh buffer cache

Hi guys,
I'm doing a performance test on a superdome's partition, i want to refresh the buffer cache everytime my process stop to work.
Can i do this operation?

Regards
Maurizio
9 REPLIES 9
Stefan Farrelly
Honored Contributor

Re: Refresh buffer cache

To flush the buffer cache to disk do;

sync; sync; sync
Im from Palmerston North, New Zealand, but somehow ended up in London...
Jeff Schussele
Honored Contributor

Re: Refresh buffer cache

Hi Maurizio,

the command to use is

sync

Do it several times to completely flush the buffer cache.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
doug mielke
Respected Contributor

Re: Refresh buffer cache

It sounds like you want to remove the data from the cache in order to do some perfomance testing, to ensure that you're testing disk performance more than cache perfomance.
If so, the sync won't help much, in that the data in cache won't change.

What you can try is do a massive i/o of unrelated data before you start your test, to load cache with 'new' data.

Then when you start your test, the system will have to go to disk to get this 'new' test data.
Maurizio Fulli
Advisor

Re: Refresh buffer cache

ok i've tried to use this command (sync) but it doesn't seems to have effect.
Through sar command i see that the %wcache and %rcache statistics are the same, before and after sync!
I've modified the kernel parametes 'dbc_min' and 'dbc_max', min to 5 and max to 50.
I want to know how the O.S. refresh the cache after a couple of processes finish to work, and if it is possible to set a timeout.
Someone tells me that the buffer cache is on the disk!!!!!
Is it real?
Thanks
Maurizio
Kevin Wright
Honored Contributor

Re: Refresh buffer cache

dbc_max defaults to 50, and dbc_min defaults to 5. BC is not on disk, it's a memory region.

You should reduce them down.

You can mount your filesystem with convosync=direct, and mincache=direct to bypass the OS buffer cache entirely.

Or you could run a memory hogging program to reduce the cache way down to almost nothing after it builds up.
Jeff Schussele
Honored Contributor

Re: Refresh buffer cache

Hi (again) Maurizio,

I'm not fully understanding what you're trying to do.

If you want to fully flush the cache of all entries for a specific filesystem, then you have to do the following

1)unmount filesystem
2)issue multiple sync commands - 3 one after the other ought to do it.
3)mount filesystem

Now, having the buffer max % at 50% is a huge waste & depending on installed RAM on this system you may want to bring this way down.

The only other thing you can do to manipulate the cache buffer would be to adjust the sync interval
/usr/sbin/syncer XX
where XX=seconds - default is 30.
But this is *not* recommended unless you're having performance issues as it could cause issues by itself.

Other thing that could be done is to bypass the buffer cache with mount options such as
convosync=direct
mincache=direct
then the buffer cache would not be used for this filesystem.

I think you need to more fully explain just *what* it is you're trying to accomplish.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
doug mielke
Respected Contributor

Re: Refresh buffer cache

An overview of cache:
When a disk i/o is performed, Unix looks in the buffer cache (memory) first for the data. If not there then unix gets the data from disk, uloads / erases from cache the least recently used data, and loads the new data into buffer cache. If you keep using this particular piece of data, it will stay in cache.

Unix periodically looks at the cache, ( by default, every 30 seconds) to see if this data has changed since it was last written to disk. If so, it is written to disk.

You can configure the period between flushes, (sync) and the amount of time since the data changed required before writting out to disk,(default I think is 10 seconds?) Altering this 2nd parameter could be usefull when altering the same block of data often the data.

You don't really get to "refresh" the cache. It gets loaded with fresh data every time 'new' data is requested.
Maurizio Fulli
Advisor

Re: Refresh buffer cache

Sorry, but the specific request is how to refresh the Emc's buffer cache.
The person that had request this wasn't enought clear to explain what he want and what he done.
Sorry to all and thanks.
Jeff Schussele
Honored Contributor

Re: Refresh buffer cache

OK then, there is no way for the host to control EMC cache policies. This is normally done by the Admin for the Array & would, I assume, using the EMC utilities - but I'm not positive.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!