Operating System - HP-UX
1833322 Members
2908 Online
110051 Solutions
New Discussion

memory (cache in Filesystem)

 
SOLVED
Go to solution
Carme Torca
Super Advisor

memory (cache in Filesystem)

Hi,

I would like to know, how may S.O. memory used for cache in FileSystem.
How it is defined and how it can changed?, maybe in the kernel?? It's possible??

Thanks!,
Carmen.
Users are not too bad ;-)
8 REPLIES 8
Jeff Schussele
Honored Contributor
Solution

Re: memory (cache in Filesystem)

Hi Carmen,

Disk buffer cache is allocated:

Dynamically - using dbc_max_pct & dbc_min_pct kernel parameters defing maximum & minimum amount fo system memory.

Fixed amount - using bufpages & nbuf kernel paramters where the former is the number of buffer pages & the latter is the number of buffer cache headers.

Setting *both* nbuf & bufpages to zero enables the dynamic. Setting any values other than zero enable the fixed size buffer cache.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Pete Randall
Outstanding Contributor

Re: memory (cache in Filesystem)

Carmen,

If I'm reading you correctly, these excerpts from SAM's help on configurable kernel parameters may help:

"Allocating system physical memory resources for file system buffer cache space. Includes the
dynamic buffer allocation parameters dbc_min_pct and dbc_max_pct , and the static buffer
allocation parameters bufpages and nbuf ."

" bufpages interacts with XYX as follows:

* bufpages = 0, nbuf = 0: Enables dynamic buffer cache.

* bufpages not zero, nbuf = zero: Creates bufpages/2 buffer headers and allocates (bufpages x4 Kbytes) of buffer
pool space at system boot time.

* bufpages = 0, nbuf not zero: Allocates nbuf*2 pages of buffer pool space and creates nbuf headers at boot time..

* bufpages not 0, nbuf not zero: Allocates bufpages pages of buffer pool space and creates nbuf buffer headers at
boot time. If the two values conflict such that it is impossible to configure a system using both of them, bufpages takes
precedence.

bufpages controls how much actual memory is allocated to the buffer pool. See nbuf.

If bufpages is zero at system boot time, the system allocates two pages for every buffer header defined by nbuf. If
bufpages and nbuf are both zero, the system enables dynamic buffer cache allocation and allocates a percentage of
available memory not less than dbc_min_pct nor more than dbc_max_pct , depending on system needs at any given
time.
The maximum amount of memory that can be allocated to the buffer pool is also affected by the amount of memory allocated
to the system for other purposes. Thus, modifying parameters that affect system memory may also affect the maximum
amount of memory can be made available to the buffer pool. "

"During file-system I/O operations, data is stored in a buffer cache, the size of which can be fixed or dynamically allocated.
When the parameters bufpages and nbuf are both set to their default value of 0, the size of the buffer cache grows or
shrinks dynamically, depending on competing requests for system memory.

The value of dbc_min_pct specifies the minimum percentage of physical memory that is reserved for use by the dynamic
buffer cache.

It is possible to set both dbc_min_pct and dbc_max_pct to the same value, 12 for example, and create a kernel that
uses exactly that percentage of physical memory for the buffer cache, regardless of the size of physical memory. "

"When the parameters bufpages and nbuf are both set to their default value of 0, the size of the buffer cache grows or
shrinks dynamically, depending on competing requests for system memory.

The value of dbc_max_pct sets the maximum percentage of physical memory that can be allocated to the dynamic buffer
cache.

It is possible to set both dbc_max_pct and dbc_min_pct to the same value, 12 for example, and create a kernel that
uses exactly that percentage of physical memory for the buffer cache, regardless of the size of physical memory. "

"This parameter is for backwards compatibility and should be set to zero because dynamic buffer cache is preferred. See
Configurable File-System Buffer Parameters and Overview of File-System Configurable Parameters for more information.
If set to a non-zero value, nbuf specifies the number of buffer headers to be allocated for the file system buffer-cache. Each
buffer is allocated 4096 bytes of memory unless overridden by a conflicting value for bufpages.

If nbuf is set to a non-zero value that is less than 16 or greater than the maximum supported by the system, or to a value
that is inconsistent with the value of bufpages, the number will be increased or decreased as appropriate, and a message
printed at boot time. "


Pete

Pete
Sridhar Bhaskarla
Honored Contributor

Re: memory (cache in Filesystem)

Hi Carmen,

By default 50% of the memory is configured to be used as buffer cache. It may grow|shrink over a period of time but to a maximum of 50% of the memory. If you changed the default settings, then you can run

#kmtune -l -q dbc_max_pct
#kmtune -l -q dbc_min_pct
#kmtune -l -q nbuf
#kmtune -l -q bufpages

If nbuf and bufpages are 0 above, then you have dynamic buffer caching in effect. At any point of time you could see a minimum of dbc_min_pct as your buffer cache.

You can get the usage better from glance's "m" window. You can alter the settings by changing dbc_max_pct and min_pct values.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Carme Torca
Super Advisor

Re: memory (cache in Filesystem)

Thanks Jef!!,
I have in a model 9000/800/N4000-75
/>
kmtune |grep dbc
dbc_max_pct 15
dbc_min_pct 5

Is it high value?, I could change maybe dbc_max_pct to 10???
Thanks!

Users are not too bad ;-)
Patrick Wallek
Honored Contributor

Re: memory (cache in Filesystem)

How much RAM do you have in your machine? The 15 value is in percent, so the max will be 15% of the amount of RAM you have.
Jeff Schussele
Honored Contributor

Re: memory (cache in Filesystem)

Hi (again) Carmen,

As usual - it depends...

On whether nbuf & bufpages are non-zero. IF they are they take precedent & you'll have a fixed size buffer cache determined by the bufpages value.

IF the *are* zero AND you're under memory pressure then 10% would be "better" than 15%.
I've found the "sweet spot" for buffer cache to be between 400 & 800MB - But that's just my opinion others may vary.
SO if you have between 4 & 8GB of system memory than 10% would be good....

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Carme Torca
Super Advisor

Re: memory (cache in Filesystem)

I,

I have 4Gb!!, then 15% is 629145Kb. Is it correct?
Thanks!,
Users are not too bad ;-)
Pete Randall
Outstanding Contributor

Re: memory (cache in Filesystem)

Carmen,

That's another "it depends" question. The only way to be sure, is to tune the amount of cache downward and monitor (through Glance or sar) your cache hits. As long as the number of cache hits remains high (in the upper 90% range), you can keep tuning buffer cache downward. When the hit ration starts to drop, you've gone too far!


Pete

Pete