Mac OS X TCP Performance Tuning

Posted on in system_administration

cover image for article

Because Darwin is BSD-based, it's no surprise that Mac OS X TCP Performance Tuning is very similar to FreeBSD TCP Performance Tuning. It is no longer necessary to enable RFC 1323 TCP Extensions (in fact, the option to do so is gone). Also, we'll set the TCP send and receive window sizes to 1 MB.

In Mac OS X 10.6 and above, Apple tied the socket buffer sizes to the number of mbuf clusters. This means that to increase the max socket buffer, we'll first need to increase the mbuf clusters.

sudo nvram boot-args="ncl=131072" 

Mac OS X does not include /etc/sysctl.conf, so you'll need to create it. Once that's done, add the following lines and reboot.

kern.ipc.maxsockbuf=16777216
net.inet.tcp.sendspace=1048576  
net.inet.tcp.recvspace=1048576  

If you've already rebooted since updating the number of mbuf clusters, you can avoid rebooting again by issuing the following commands:

sudo sysctl -w kern.ipc.maxsockbuf=16777216
sudo sysctl -w net.inet.tcp.sendspace=1048576
sudo sysctl -w net.inet.tcp.recvspace=1048576

Part 5 of the TCP Performance Tuning series

My Bookshelf

Reading Now

Other Stuff