1834149 Members
4012 Online
110064 Solutions
New Discussion

Buffer cache

 
LucianoCarvalho
Respected Contributor

Buffer cache

hi guys! Could someone better explain the meaning of "%wcache" and/or "%rcache" on sar -b output? I know that a high percetage for wcache is good, but what is the meaning of having a wcache with 95% hit ratio? thanks in advance.
10 REPLIES 10
doug mielke
Respected Contributor

Re: Buffer cache

It's the % of write requests served from cach, and % read requests served from cache.

I never get as high as 95% on writes, so this is likely good for you.

However, many sloopy programs show themselves first in sar -b.

for instance, a looping program will load a chunk of data into mem. than i/o to it repeatedly. Cache hit rates go up as a result, appearing to be a well running system.
Usually, high rates are good.

Steven E. Protter
Exalted Contributor

Re: Buffer cache

This doc might help some.

http://www1.itrc.hp.com/service/cki/search.do?category=c0&docType=Security&docType=Patch&docType=EngineerNotes&docType=BugReports&docType=Hardware&docType=ReferenceMaterials&docType=ThirdParty&searchString=UPERFKBAN00000726&search.y=8&search.x=28&mode=id&admit=-682735245+1068738026714+28353475&searchCrit=allwords

DocId: UPERFKBAN00000726 Updated: 20031008

I don't think the itrc folks like me pasting in relavent sections.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bernhard Mueller
Honored Contributor

Re: Buffer cache

Hi,

let me quote from a system perf doc:

"The goal of the buffer cache is to increase the speed of disk io reads and writes. The trade off for that increased performance is the usage of a percentage of main memory. It is desirable to see %rcache >= 90, and %wcache >= 70%. Some system configurations (for example systems with raw partitions or applications that perform random reads and writes) will never see these buffer cache hit rates. The goal is to adjust the cache to give the best performance for that particular system."

Regards
Bernhard
Kevin Wright
Honored Contributor

Re: Buffer cache

it's just the % of time that the write, or read request was served from the BC without going out to disk. A good read % is 90 or above, and 60% or so for write is a benchmark, although highly dependant on your application, whether or not you write sequentially or not has a big impact due to the read ahead algorithims in the BC.
LucianoCarvalho
Respected Contributor

Re: Buffer cache

I understood that guys. But how a value of 90%, as an example, relates to the size of the buffer cache.
That is, if I have a value of 90% for %wcache, itt means that the size of buffer cache is ok. But if I have a value of 30% for %wcache, it means that the buffer cache is too large. That's what I don't undertand yet.
Michael Steele_2
Honored Contributor

Re: Buffer cache

rcache has to be 70% or better.
wcache has to be 100%.

Raise or lower dbc_max_pct and dbc_min_pct as needed.
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: Buffer cache

Sorry, I had those two reversed. (* trying to feed a baby *)

rcache has to be 100%.
wcache has to be 70% or better.
Support Fatherhood - Stop Family Law
doug mielke
Respected Contributor

Re: Buffer cache

I've played with buffcache size for ages, and my write % is never as high as my read%.
But I'm sure the results are very dependent on the applications needs.

30% write is lower than I've usually seen, and would be an indication that cache size is too low, or that writes are scattered.

If writes were, in theory, totally random across all storage, than cache hit rate would always be very low, and no amount of cache would make much difference.

Also, the higher the rate, the less the effect of more cache will have on the %. Getting that last bit of % requires massive amounts of cache, and as has been well documented on this site, large cache with it's large resource overhead, can reduce performance as cache size increases.
Geoff Wild
Honored Contributor

Re: Buffer cache

This is a good posting on the subject:

http://forums1.itrc.hp.com/service/forums/parseCurl.do?CURL=%2Fcm%2FQuestionAnswer%2F1%2C%2C0x502aec36c7ff304ca1b648ff65c4ef87%2C00.html&admit=716493758+1068746750314+28353475

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Lee Huei
Regular Advisor

Re: Buffer cache

%wcache Buffer cache hit ratio for write requests e.g., 1 - bwrit/lwrit;

%rcache Buffer cache hit ratio for read requests e.g., 1 - bread/lread;

The -b option to sar reports the number of transactions to block or physical devices.
The "bread" and "bwrite" don't refer to the number of bytes or blocks transferred, but
to the number of transers (or transactions) to a block device.
The "pread" and "pwrite" then refer to the number of transactions made to a physical or raw device.

Idealy we want to see an average %wcache of 95% or greater. If system consistently shows
%wchache lower than 75% it would be adviseable to lower the value of dbc_max_pct.

It is adviseable to always keep buffer cache lower or equal to 300Mbytes. This can be controlled by kernel parameter
dbc_min_pct & dbc_max_pct if you are using dynamic buffer.