This page contains information on tuning FreeBSD hosts connected at speeds of 1Gbps or higher.
Note: This information is quite old and likely out of date. If you are currently running FreeBSD and know what needs to be updated, please contact us.
Basic tuning configuration
Here are the recommended settings for /etc/sysctl.conf. Some of these are the default settings, but are included in case someone changed the defaults on your system. Explanations are below.
# set to at least 16MB for 10GE hosts
# set autotuning maximum to at least 16MB too
# enable send/recv autotuning
# increase autotuning step size
# set this on test/measurement hosts
Advanced congestion control in FreeBSD
FreeBSD supports TCP autotuning and advanced congestion control algorithms in all currently-supported releases. You can check which are available in the running kernel using:
To make additional algorithms available in the kernel, the appropriate module must be loaded. The congestion control modules are in /boot/kernel and begin with cc_ - they can be listed with the following command:
ls /boot/kernel/cc_* | grep -v symbols
To load a particular congestion control algorithm (for example htcp) you can use:
and you will then be able to set the congestion control algorithm using this:
Enabling congestion control algorithms at boot time
Depending how your kernel is built, you may not have the algorithm you want available by default at boot time, and will need to load the driver during the boot process. To to this add the following to /boot/loader.conf:
The htcp algorithm will then be loaded at boot time, and will be enabled when sysctl.conf is processed at boot time and the net.inet.tcp.cc.algorithm=htcp variable is set.
By default, FreeBSD caches connection details such as the slow start threshold and the congestion windows size from the previous connection to the same host for 1 hour. While this is a good idea for a web server, it makes it hard to do network throughput testing, as 1 large congestion event will throttle performance for the next hour. To reduce this effect, set hostcache.expire to 1.
This will still cache values for 5 minutes, for reasons described in this article from the Centre for Advanced Internet Architectures (CAIA) at Swinburne University in Australia. This article has a lot of other good tuning information for FreeBSD too.