On Nov 8, 2004, at 1:17 PM, cscott@speakeasy.net wrote:> I have a server thats sole purpose for existence is serving a fixed
> group of files from a dedicated filesystem. There is a directory tree
> with about 50K files that is requested in a random order. I have been
> trying find the correct sysctl variable to dedicate more RAM to the
> filesystem buffer to reduce the latency in the server caused by the FS
> reads. Is there such a variable? What is the variable I should be
> working with? vfs.maxbufspace is read-only.
So long as the system has enough memory available for the working sets
of the processes being run, FreeBSD will use the rest of the memory for
caching stuff from the filesystem without needing any special tuning.
However, if you really want to be sure that the files stay in memory,
consider using a RAMdisk (see "man md"). You might also want to read
all of "man tuning", but the following section is particularly
relevant
to your case:
The vfs.vmiodirenable sysctl defaults to 1 (on). This parameter
controls
how directories are cached by the system. Most directories are
small and
use but a single fragment (typically 1K) in the filesystem and
even less
(typically 512 bytes) in the buffer cache. However, when
operating in
the default mode the buffer cache will only cache a fixed number of
directories even if you have a huge amount of memory. Turning on
this
sysctl allows the buffer cache to use the VM Page Cache to cache
the
directories. [ ... ]
There are various other buffer-cache and VM page cache related
sysctls.
We do not recommend modifying these values. As of FreeBSD 4.3,
the VM
system does an extremely good job tuning itself.
--
-Chuck