Date: Wed, 24 Jul 2002 12:32:09 -0700 (PDT) From: Jeff Jirsa <jeff@boris.st.hmc.edu> To: "Balaji, Pavan" <pavan.balaji@intel.com> Cc: "'James Snow'" <snow@teardrop.org>, <ntai@mac.com>, <freebsd-questions@FreeBSD.ORG> Subject: RE: Number of mbuf clusters (NMBCLUSTERS) Message-ID: <20020724122351.T71540-100000@boris.st.hmc.edu> In-Reply-To: <3D386AED1B47D411A94300508B11F18703BC5C25@fmsmsx116.fm.intel.com>
index | next in thread | previous in thread | raw e-mail
On Wed, 24 Jul 2002, Balaji, Pavan wrote:
>
> You can increase the maximum number of clusters in /usr/src/sys/sys/sysctl.h
> and recompile the kernel. But make sure that you have a stable kernel image
> ready, just in case you increase this value so much that your kernel doesn't
> boot ;)
>
> I guess the default value is around 9, while for 256MB mem, you can go upto
> maybe 10000 clusters.
That's questionable advice. Reading the tuning(7) man page:
NMBCLUSTERS may be adjusted to increase the number of network mbufs the
system is willing to allocate. Each cluster represents approximately 2K
of memory, so a value of 1024 represents 2M of kernel memory reserved for
network buffers. You can do a simple calculation to figure out how many
you need. If you have a web server which maxes out at 1000 simultaneous
connections, and each connection eats a 16K receive and 16K send buffer,
you need approximate 32MB worth of network buffers to deal with it. A
good rule of thumb is to multiply by 2, so 32MBx2 = 64MB/2K = 32768. So
for this case you would want to se NMBCLUSTERS to 32768. We recommend
values between 1024 and 4096 for machines with moderates amount of mem-
ory, and between 4096 and 32768 for machines with greater amounts of mem-
ory. Under no circumstances should you specify an arbitrarily high value
for this parameter, it could lead to a boot-time crash. The -m option to
netstat(1) may be used to observe network cluster use.
Figure out how many connections you'll deal with, and then increase the
value accordingly, rather than simply guessing and possibly wasting
memory you may want to use elsewhere. I'd also recommend modifying your
kernel config file rather than sysctl.h, and then rebuilding.
- Jeff
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020724122351.T71540-100000>
