Linux Kernel
Tuning Using System Control
Dustin Puryear
Some of the most notable performance improvements for Linux can be accomplished
via system control (sysctl) in /proc/sys. Unlike most other areas of /proc under
Linux, sysctl variables are typically writable, and are used to adjust the running
kernel rather than simply monitor currently running processes and system information.
In this article, I'll walk you through several areas of sysctl that can
result in large performance improvements. While certainly not a definitive work,
this article should provide the foundation needed for further research and experimentation
with Linux sysctl.
Note that I wrote this article with the 2.4 kernel in mind. Some variables
may exist in earlier kernels but not in 2.4, or vice versa.
Working with the sysctl Interface
The sysctl interface allows administrators to modify variables that the kernel
uses to determine behavior. There are two ways to work with sysctl: by directly
reading and modifying files in /proc/sys and by using the sysctl program supplied
with most, if not all, distributions. Most documentation on sysctl accesses
variables via the /proc/sys file system, and does so using cat for viewing
and echo for changing variables, as shown in the following example where
IP forwarding is enabled:
# cat /proc/sys/net/ipv4/ip_forward
0
# echo "1" > /proc/sys/net/ipv4/ip_forward
# cat /proc/sys/net/ipv4/ip_forward
1
This is an easy way to work with sysctl. An alternative is to use the sysctl program,
which provides an easy interface to accessing sysctl. With the sysctl program,
you specify a path to the variable, with /proc/sys being the base. For example,
to view /proc/sys/net/ipv4/ip_forward, use the following command:
# sysctl net.i
|