Building simplicidade.org: notes, projects, and occasional rants

Network throughput "problems"

A friend of mine was complaining that he could only upload a file to my server at 2Mbytes/sec with his FIOS link at home. Some people have interesting "problems".

Anyway, I send him my /etc/sysctl.conf that I have on my Mac for quite some time without any problems, and with significant gains in network performance on my local LAN (specially for other computers with Gigabit ethernet).

net.inet.tcp.mssdflt=1440
kern.ipc.maxsockbuf=800000
net.inet.tcp.sendspace=400000
net.inet.tcp.recvspace=400000

Stick those lines in your /etc/sysctl.conf and they will be active every time your Mac reboots. Make sure you place them on all your Macs. To activate them right now, run this:

sudo sysctl -w net.inet.tcp.mssdflt=1440
sudo sysctl -w kern.ipc.maxsockbuf=800000
sudo sysctl -w net.inet.tcp.sendspace=400000
sudo sysctl -w net.inet.tcp.recvspace=400000

You should see network a better network throughput immediately.

There is a fifth setting:

net.inet.tcp.sockthreshold=0

but I admit not to fully understand the implications of his use. Apparently without it, the sendspace/recvspace settings would not work, but my tests tell me the oposite. I'll update this when I do know if/when to use the one.

For reference, a local FTP transfer to a 100Mbit server was not using all of the bandwidth. With just the first line, I was able to saturate the server link. With all the lines, over a gigabit ethernet link, I was able to reach 35Mbytes/sec between two Macs. Without: a meager 6Mbyte/sec.

All the gory details are available in a study by the Pittsburgh Computing Center.

Update: sorry, miss-typed the values, remove the extra zero.