The Linux kernel and the distributions that package it typically provide very conservative defaults to certain network settings that affect networking parameters. You can tune then to optimise your network performance.

These settings can be tuned via the /proc filesystem or using the sysctl program. The latter is often better, as it reads the contents of /etc/sysctl.conf, which allows you to keep settings across reboots.

The following is a snippet from /etc/sysctl.conf that may improve network performance:

net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_syncookies = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

The above isn't to replace what may already exist in /etc/sysctl.conf, but rather to supplement it. The first command enables TCP window scaling, which allows clients to download data at a higher rate by enabling extra bits in TCP packets that are used to increase the window size.

The second command enables TCP SYN cookies, which is often enabled by default and is extremely effective in preventing conditions such as SYN floods that can drain the server of resources used to process incoming connections.

The last four options increase the TCP send and receive buffers, which allow an application to move its data out faster so as to serve other requests. This also improves the client's ability to send data to the server when it gets busy.

By adding these commands to the /etc/sysctl.conf file, you ensure they take effect on every reboot. To enable them immediately without a reboot, use:

# sysctl -p /etc/sysctl.conf

To see all of the currently configured sysctl options, use:

# sysctl -a

This will list all of the configuration keys and their current values. The sysctl.conf file allows you to configure and save new defaults; what you see from this output are the defaults defined in the kernel that are currently effective. To see the value of one particular item, use:

# sysctl -q net.ipv4.tcp_window_scaling

Likewise, to set the value of one item without configuring it in sysctl.conf -- and understanding that it won't be retained across reboots, use:

# sysctl -w net.ipv4.tcp_window_scaling=1

This can be useful for testing the effectiveness of certain settings without committing them to being defaults.

Open Sourcery This was published in Open Sourcery, check every Monday for more stories

Related links

Comments

1

tej - 07/09/08

net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_syncookies = 1

both these options are mutual exclusive, because syncookies disable many features of tcp e.g. TCP window scaling, SACK etc. even without syncookies the kernel is usually strong enough to defend against syn floods.

HTH
thanks
-tej

» Report offensive content

Leave a comment

You must read and type the 6 chars within 0..9 and A..F

* indicates mandatory fields.

1

tej - 09/07/08

net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_syncookies = 1 both these options are mutual exclusive, because syncookies disable many features of tcp e.g. TCP window ... more

Log in


Sign up | Forgot your password?

  • Staff Aussies to pay more for Win 7

    If you are looking to make some money in these troubled times, perhaps importing copies of Windows 7 could be for you. Read more »

    -- posted by Staff

  • Staff Firefox: Greens want it, 3.5rc2 not up to par

    This week's roundup looks at the situation surrounding a campaign to change Outlook HTML renderer, a Greens MP wants to install Firefox but is restricted and all the photos from the iPhone 3GS launch. Read more »

    -- posted by Staff

  • Chris Duckett Microsoft misses the Outlook point

    Ask designers which mail program is the bane of their existence, and you'll find that Outlook tops the list. The reason why the most popular email reader is also the most painful is simple: it uses Word to render HTML emails. Read more »

    -- posted by Chris Duckett

What's on?