A number (set by the tunable
ufs_ninode) of inactive
inode entries are also kept.
ufs_ninode is set using the
same calculation as
ncsize above, but the total size of
the inode cache will be bigger, as
ufs_ninode only limits
the inactive entries. It doesn't normally need tuning, but if the DNLC
is increased, make
Inactive files are files that were opened already
and might be opened again. If the number of inactive
entries grows too large, entries that have not been used recently are
discarded. Stateless NFS clients do not keep the inode active, so the
pool of inactive inodes caches the inode data for files that are opened
by NFS clients. The inode cache entry also provides the location of
every data block on disk and the location of every page of file data
that is in memory.
If an inactive inode is discarded, all of its file data in memory are
also discarded, and the memory is freed for reuse. This is reported by
sar -g as
%ufs_ipf, the percentage of inode
cache entries that had pages when they were freed (cached file data
discarded). My href="http://www.sun.com/951001/columns/adrian/column2.html"> virtual_adrian.se rule warns if nonzero values are seen.
The inode cache hit rate is often 90 percent or more, meaning that
most files are accessed several times in a short period of time. If you
run a cache-busting command that looks at many files once only, like
ls -R, you will see a much lower DNLC
and inode cache hit rate. An inode cache hit is quick, as a hashed
lookup finds the entry efficiently. An inode cache miss varies, as the
inode may be found in the UFS metadata buffer cache, or a disk read may
be needed to get the right block of inodes into the UFS metadata buffer
This cache is often referred to as just "the buffer cache," but there
has been so much confusion about its use that I like to be specific.
Historically, Unix systems used a buffer cache to cache all disk
data, assigning approximately 10 percent of total memory to this job.
This changed around 1988, when SunOS 4.0 came out with a combined
virtual memory and I/O setup. This setup was later included in System V
Release 4, and variants of it are used in most recent Unix releases.