Common Misconfigured HP-UX Resources (April 2006)
dbc_min_pct 5
The dbc_min_pct tunable cannot be less than 2 and dbc_max_pct cannot be greater than 90.
The dbc_min_pct and dbc_max_pct tunables are dynamic on HP-UX 11i v2 and can be modified
without a system reboot.
When the system is initially booted, the system allocates dbc_min_pct (the default is 5 percent) of
memory for buffer pages (each page is 4,096 bytes). The system also allocates one buffer header for
every two buffer pages. The size of the buffer cache will grow as new pages are brought in from disk.
The buffer cache can expand very rapidly, so that it uses the maximum percentage of memory
specified by the dbc_max_pct tunable. A large file copy or a backup are operations that can cause
the buffer cache to quickly reach its maximum size. While the buffer cache expands quickly, it
decreases in size only when there is memory pressure.
You can configure a static buffer cache to a fixed size by setting either nbuf or bufpages. Setting
nbuf specifies the number of buffer headers that should be allocated. Two buffer pages are allocated
for each buffer header for a total of nbuf*2 buffer pages. If the bufpages kernel parameter is set
and nbuf is 0, then the number of buffer pages is set to bufpages and one buffer header is
allocated for every two buffer pages for a total of bufpages/2 buffer headers. If both nbuf and
bufpages are set, then nbuf is used to size the buffer cache. You can also configure a static buffer
cache by setting the dbc_min_pct and dbc_max_pct tunables to the same value.
There are trade-offs associated with either a static or dynamic buffer cache. If memory pressure exists,
a static buffer cache cannot be reduced, potentially causing more important pages to be swapped out
or processes deactivated. In contrast, some overhead exists in managing the dynamic buffer cache,
such as the dynamic allocation of the buffers and managing the buffer cache address map or buffer
cache virtual bitmap (the bufmap and bcvmap tunables are discussed later in more detail). A
dynamic buffer cache also expands very rapidly, but contracts only when memory pressure exists.
How the Buffer Cache Works
The main parts of the buffer cache are the buffer cache hash table, buffer headers, and buffer pages
themselves. At a minimum, allocate one page for a buffer header, even if the buffer is only 1 KB in
size. The maximum buffer size is 64 Kb. Every buffer in the cache is linked through buffer cache hash
lists. When data from a disk is needed, use the block device (specifically the vnode address of the
block device) and the block number to calculate a hash index into the buffer cache hash table, which
is an array of buffer cache hash headers. The buffer cache hash header will point to a linked list of
buffers whose block device and block number hash to the same hash header. By searching the hash
chain, we can tell if the requested block exists in the buffer cache. In HP-UX 11i v1 and later, there is
one hash lock to cover every eight hash chains. Prior to HP-UX 11i v1 there was a fixed number of
128 hash locks.
If an attempt is made to access a block from a device and it does not exist in the appropriate hash
chain, a buffer cache miss occurs and one of two actions will occur:
• A new buffer is allocated (if a dynamic buffer cache is used). Data must be read in from disk.
• An existing buffer is reused (if a static buffer cache is used or the buffer cache is already at
the dbc_max_pct) and data must be read in from disk. The buffer reused is either a buffer
that has been invalidated (for example, a file has been removed or a file system has been
unmounted), or the buffer has not been accessed recently.
However, if the desired buffer is found in the buffer cache, then the data can be accessed without
accessing the disk.
8