Tune high-speed networks for faster transfers
Jun 19, '06 07:30:04AM
Contributed by: Anonymous
Here's a little blurb from an article I found on the internet regarding OS performance tuning, written by the Pittsburgh Supercomputing Center. Note that this only really helps on data transfers on gigabit ethernet networks, though it might help latency on 100 megabit networks.
Mac OS X has a single sysctl parameter, kern.ipc.maxsockbuf, to set the maximum combined buffer size for both sides of a TCP (or other) socket. In general, it can be set to at least twice the BDP. E.g:
sysctl -w kern.ipc.maxsockbuf=8000000
The default send and receive buffer sizes can be set using the following sysctl variables:
sysctl -w net.inet.tcp.sendspace=4000000
sysctl -w net.inet.tcp.recvspace=4000000
If you would like these changes to be preserved across reboots you can edit /etc/sysctl.conf.
Read on for more detailed instructions on how to use this on your Mac.
The steps:
- Benchmark your connection either at a site from the article or a local fileserver, and note the data transfer speed.
- Try the transfer again. If its cached in ram on the server it will be much faster.
- Run the following commands in order, in Terminal. Type each line individually and in order, or else your TCP/IP stack will go dumb. Also, the maxsockbuf must be at least the sum of the send/recv space buffers, or TCP/IP will go dumb.
$ sysctl -w kern.ipc.maxsockbuf=8000000
$ sysctl -w net.inet.tcp.sendspace=4000000
$ sysctl -w net.inet.tcp.recvspace=4000000
- Run your benchmark test again.
If you want to make the change permanent the best way to accomplish this to download Apple's Broadband Tuner. This will add the sysctl.conf file, and the line to rc. Then edit the /etc/sysctl.conf file to the above specs and reboot.
In my testing across a gigabit Ethernet network using an OS X Server with 1.5GB of RAM and two mirrored disks, I can move about 40 megabytes a second. Previously, I obtained about 15 megabytes a second. If you are on a 100 megabit network, your max bandwidth is 10 megabytes a second, so you won't see the increase.
Comments (19)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060616112919669