kern.ipc.nsfbufs Max Value?

Ruslan Ermilov ru at
Sun Dec 10 12:18:12 PST 2006

On Sun, Dec 10, 2006 at 08:23:00AM -0800, Holtor wrote:
> I have an extremely busy web server here serving mostly static html pages
> and images using apache 2.2.3 with sendfile enabled. It's a Dual Xeon
> server with 4 GB RAM and I've tweaked many sysctl variables to help the
> system chug along. At peak, apache is running nearly 1,500 child
> processes.
Have a look at ports/www/nginx for the alternative web server.

> To my question, what is the max value of kern.ipc.nsfbufs and does it
> depend on any other values? I had originally increased it to 32768 however
> sfbufs got maxed out slowing the server. Then I increased it to 65536 and
> currently have these results:
> 45348/48844/65536 sfbufs in use (current/peak/max)
> To me that's too close for comfort so I further tried to increase it to
> 131072 however with that setting the system would not boot. The kernel
> page faulted with an error in the swapper process until I decreased
> kern.ipc.nsfbufs back to 65536.
> Is there anyway to increase this value even higher? The server has nearly
> 2.5 GB of free ram out of the 4 GB installed and the load averages are
> very low 0.07, 0.15, 0.34 so hopefully it's possible to tweak this some
> more.
> Any ideas?
On i386, the sfbufs are allocated from kernel_map which is basically
limited by the amount of KVA.  Try increasing KVA_PAGES to give more
virtual space for the kernel (at the cost of reducing the virtual
address space for userland); see the comments regarding this option
in sys/i386/conf/NOTES.  On amd64, you wouldn't have this problem as
sf_bufs are only opaque objects there and don't consume real memory.

Ruslan Ermilov
ru at
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-stable mailing list