Mac OS X Snow Leopard ethernet / network optimization

After some light prodding from [Jauder](http://www.jauderho.com/), I set out to optimize my Mac OS X 10.6.4 (Snow Leopard) network settings. There is a lot of information out there about how you might optimize a Mac OS X network, but I couldn't actually find any benchmarks. First, I installed iperf on my Mac Pro and MacBook Pro, which are both connected to a gigabit switch (WiFi off). With the MBP as server and Mac Pro as client, iperf reported a transfer speed of 911 Mbit/sec:

------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 3.55 MByte (default) ------------------------------------------------------------ Client connecting to 192.168.2.57, TCP port 5001 TCP window size: 65.0 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.2.6 port 51316 connected with 192.168.2.57 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 1.06 GBytes 911 Mbits/sec

Now, for the tweaking. I created *sysctl.conf* in /etc and stuck this in it:

sysctl -w net.inet.tcp.win_scale_factor=8 kern.ipc.maxsockbuf=16777216 net.inet.tcp.sendspace=8388608 net.inet.tcp.recvspace=8388608

If you don't know what these are, you can do some Google searches to find out. iperf reported throughput of 937 Mbit/sec, a 26 Mbit/sec gain! These tests are repeatable.

------------------------------------------------------------ Client connecting to 192.168.2.57, TCP port 5001 TCP window size: 65.0 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.2.6 port 49377 connected with 192.168.2.57 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 1.09 GBytes 937 Mbits/sec

I have always been interested in jumbo frames, so I turned on jumbo frames (MTU 9000) on both the MacBook Pro and Mac Pro and tested it again. My switch supports jumbo frames.

------------------------------------------------------------ Client connecting to 192.168.2.57, TCP port 5001 TCP window size: 69.9 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.2.6 port 49403 connected with 192.168.2.57 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 1.03 GBytes 887 Mbits/sec

Enabling jumbo frames reduced throughput to 887 Mbits/sec -- a reduction of 50 Mbits/sec (or 24 Mbit/sec, from the stock configuration). Furthermore, with a MTU of 9000, Finder.app started exhibiting long timeouts (no GUI response).

My ReadyNAS Pro supports jumbo frames, but when I turn it on (and restart the box), I can no longer access the admin page from a machine with MTU set at 9000 (it works fine from a machine with MTU 1500). Tweaking jumbo frame support on the Mac is just too much work. I disabled jumbo frames on all machines connected to my switch, and I'm happy now.

I am, however, using jumbo frames on the second gigE port on the Mac Pro, which is connected directly to a second ReadyNAS Pro via iSCSI (which is also set to use jumbo frames). That connection seems to work fine, and ATTO's Xtend SAN[^1] iSCSI initiator is rock solid and works when the Mac is booted into a 64-bit kernel[^2]. Benchmarks show sustained reads of over 110 MBytes/sec and writes at around 90 MBytes/sec.

[^1]: The only annoying issue with Xtend SAN is that it costs $50 more to download than it does to buy a physical box. Whaa??

[^2]: GlobalSAN is free, but does not work in 64-bit mode.

So there you go: actual numbers to back up a network tweaking discussion!