Context:Using Fedora 11's default installation configuration, reliable network services are provided.
Problem:No specific issue but performance-related improvements investigated. TCP settings, set for very small "data windows" (small packet sizes), require more packets, creating more network traffic. If set too small, the overhead for sending more packets could cause slower network performance and possibly higher CPU usage.
Constraints:I had no specific constraints, although I did want a solution that did not require installation of third-party software or other non-standard elements for a Fedora 11 distribution.
Details:For root or super user accounts, most Linux installations offer access to TCP settings. These settings tell the network card (NIC) and Linux kernel how to manage transmission data. By adjusting these settings, you can affect how much time the computer and NIC spend at these various networking tasks.
Solutions:After doing some research, I found
this site which describe changes that would or could improve network performance. Since I needed to apply these changes on more than one computer, I decided to script the process. Also, since this task was mostly a new domain for me, I decided to backup the existing TCP settings before writing new TCP settings.
The results is a "simple in nature" script for improving TCP performance. Rather than posting an almost 200 line BASH script on the blog, you can get it from this link:
In general terms, this script increases the size of the TCP packets being sent. There are other features enabled which I did not fully research, most explained in the first resource link.
Script Features:- Supports -h and --help command line arguments to get limited help
- Simple to use: just execute the script and follow the directions (mostly pressing the space bar or CTRL C to quit)
- Confirms necessary tools are available before starting the process
- Backs up current settings into a uniquely named file [default name provided, uniqueness handled by the script and reported to the user]
- Backup file is formatted (but not tested) to be executable for restoring previous settings
- Detects the currently "in use" NIC to make any card-specific setting changes
- Requires root via sudo access to execute changes. (not required to perform the setting backups)
Note:Read this script thoroughly before executing it. If you do not understand it or you are not comfortable with it, I strongly suggest you do not execute it. This script was designed specifically for Fedora 11 distributions and it may or may not work on your Linux distribution. This script is platform-specific and is not expected to work on any other platform (i.e. Windows, Mac, etc)
Results:I did not develop a metric for testing the results before hand. Here are my subjective observations afterward:
- Web: it appears that before the changes I could sometimes see web pages loading individual elements. After it appears that web pages "snap" onto the screen quickly.
- SSH: appears to have no significant impact on SSH. This most likely do to two issues with SSH it's self: limited packet size and single-threaded (de)encryption services.
- Downloads (web): I don't have any specific impressions of previous speeds but I believe there is an improvement. I have a good ISP so I am seeing 1.7M (peaking at 2.2M) transfer rates per second from a relatively close-by commercial site, which seems higher than before.
References:Additional reading here:
Disclaimer:This solution worked for me. It may or may not work for you. I am not responsible for your actions nor your results of your actions should you act on what you read here or execution of the script I provided for this blog entry. I do not claim expertise in this very specific area and only convey my experience. There is no warranty on this (and most) free information.
Followup (August 30, 2009)It appears that the default settings in the provided version 0.2 script may have introduced an issue with some web sites, most noticeably with streaming audio and video with Flash. Using a previous configuration I used that didn't appear to have this issue at the time, I have updated the script (0.4) with some less aggressive settings. This update also has a more execution-friendly backup file format. Additional testing so far seems more consistent.
Followup (September 2, 2009)The problems I experienced seems to be related to a kernel update for Fedora 11. More details here:
As the problems I experienced are not related to the TCP Tuning, I plan to update the script to support multiple types of settings from minor to aggressive TCP tuning.
Followup (September 3, 2009)I have updated the
tcpTuning.sh script to 0.5. I have added 3 different tuning profiles:
- -0 = tune TCP performance to near-default installation settings
- -1 = tune moderate TCP performance settings
- -2 = tune aggressive TCP performance settings
tcpTuning.sh still supports -h and --help in case you forget these options.