Add section on VM system tuning

This commit is contained in:
Matthew Dillon 1999-02-08 20:21:36 +00:00
parent 86cd11cd46
commit cbb7fe3ee0
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=4252

View file

@ -1,4 +1,4 @@
<!-- $Id: vm.sgml,v 1.1 1999-02-06 20:20:17 dillon Exp $ -->
<!-- $Id: vm.sgml,v 1.2 1999-02-08 20:21:36 dillon Exp $ -->
<!-- The FreeBSD Documentation Project -->
<sect><heading>The FreeBSD VM System<label id="vm"></heading>
@ -160,6 +160,64 @@
utilization broken down by zone.
<p>
<sect1><heading>Tuning the FreeBSD VM system</heading>
<p>
A concerted effort has been made to make the FreeBSD kernel dynamically
tune itself. Typically you do not need to mess with anything beyond
the 'maxusers' and 'NMBCLUSTERS' kernel config options. That is,
kernel compilation options specified in ( typically )
/usr/src/sys/i386/conf/XXX. A description of all available kernel
configuration options can be found in /usr/src/sys/i386/conf/LINT.
<p>
In a large system configuration you may wish to increase 'maxusers'.
Values typically range from 10 to 256.
<p>
If your system is going to use the network heavily, you may want
to increase NMBCLUSTERS. Typical values range from 1024 to 4096.
Each cluster represents around 16KBytes so do not overdo it.
<p>
The NBUF parameter is also traditionally used to scale the system.
This parameter determines the amount of KVA the system can use to
map filesystem buffers for I/O. Note that this parameter has nothing
whatsoever to do with the unified buffer cache! This parameter
is dynamically tuned in -3.x and later kernels and should generally not
be adjusted manually. We recommend that you NOT try to specify an
NBUF parameter. Let the system pick it. Too small a value can result
in extremely inefficient filesystem operation while too large a value
can starve the page queues by causing too many pages to become wired
down.
<p>
By default, FreeBSD kernels are not optimized. You can set debugging
and optimization flags with the 'makeoptions' directive in the kernel
configuration. Note that you should not use -g unless you can
accomodate the large ( typically 7 MB+ ) kernels that result.
<p><tt>makeoptions DEBUG="-g"</tt>
<p><tt>makeoptions COPTFLAGS="-O2 -pipe"</tt>
<p>
Sysctl provides a way to tune kernel parameters at run-time. You
typically do not need to mess with any of the sysctl variables,
especially the VM related ones.
<p>
Run time VM and system tuning is relatively straightforward. First,
use softupdates on your UFS/FFS filesystems whenever possible.
The /usr/src/contrib/sys/softupdates/README file contains instructions
( and restrictions ) on how to configure it up.
<p>
Second, configure
sufficient swap. You should have a swap partition configured on each
physical disk, up to four, even on your 'work' disks. You should have
at least 2x the swap space as you have main memory, and possibly even
more if you do not have a lot of memory. You should also size your
swap partition based on the maximum memory configuration you ever
intend to put on the machine so you do not have to repartition your
disks later on. If you want to be able to accomodate a crash dump,
your first swap partition must be at least as large as main memory
and /var/crash must have sufficient free space to hold the dump.
<p>
NFS-based swap is perfectly acceptable on -4.x or later systems, but
you must be aware that the NFS server will take the brunt of the
paging load.
<em>Contributed by &a.dillon;.<newline>
6 Feb 1999.</em>