kern.ipc.somaxconn kern.maxfiles kern.maxfilesperproc kern.maxprocperuid kern.ipc.nmbclusters
These is probably one of the most crucial areas to tune, otherwise your services are brought to their knees by hitting maxproc or maxfile ceilings. For some reason the base install of FreeBSD is not designed for a heavily trafficked server which always makes initital configuration a PITA because it’s never easy or quick. Anyway, here’s what I did:
In /boot/loader.conf (things I added):
kern.ipc.nmbclusters=32768
nmbclusters has to do with tcp traffic. When this is set to low, you may see things like unable to open unix socket, httpd requests could get denied…basically if this limit is reached, services stop working because there’s no more “room” for them to operate within.
In /etc/sysctl.conf (things I added):
vfs.vmiodirenable=1
kern.ipc.somaxconn=8192
kern.maxfiles=65536
kern.maxfilesperproc=65535
kern.maxprocperuid=32768
vfs.vmiodirenable — recommended by others to be set like above. Do this if you have a high-traffic server.
kern.maxfiles — max files allowed to be open at one time by the kernel.
kern.maxfilesperproc — max files allowed to be open by a process at a time.
maxprocperuid — max processes per user id to be running at a time.


