Performance Tuning Apache Under FreeBSD

When you are running Apache as your Web server on top of FreeBSD, you have a lot of parameters to tune in order to achieve maximum performance.

As with most operating systems, the TCP/IP listen queue is often the first limit encountered. It restricts the pending TCP requests. The second important parameter is the number of mbuf clusters, which should be increased. Additionally, you can increase the maximum number of allowed child processes and open file descriptors. So, for a heavily loaded machine you may want to increase these values in your kernel config as depicted in Example 3.

Additionally, you can try to use maximum optimization when building the kernel itself by using the GCC compiler flags
-mpentium, -O2, -fexpensive-optimizations, and
-fomit-frame-pointer, or even try to compile the kernel with the latest EGCS-based Pentium-GCC variant. But please be careful: Always keep a working kernel at hand when doing such optimization tests.

After tuning your operating system you can try to enhance the performance of Apache. In addition to setting the above kernel parameters you should first increase the corresponding Apache parameters when building, as depicted in Example 4(a), and then tune the Apache configuration file as depicted in Example 4(b).