Sunday, March 3, 2013
Measuring and optimizing Network Throughput on OSX
I've been cleaning up my home network; optimizing what servers I need to run for certain functions. There are a couple things to speed up and optimize your home network. First of all, you will want to measure your throughput with some tools. My current tool of choice is iperf.
I've been using iperf on Linux for a while and found a pre-built binary for OSX. If you don't care for the command line, a java version is also available called jperf.
It is a very simple too to use.
On the server, simply run the following:
On the client, you connect to the server by:
iperf -c XXX.XXX.XXX.XXX
(XXX.XXX.XXX.XXX = Ip address).
As you can see below, on my home network, I am getting 986 Mbits/sec. Roughly123 Megabytes per second.
You can specify other options such as formatting like this:
iperf -c 172.16.1.39 -f M
The -f flag will show the results in Megabytes per second
iperf is a great cross platform tool. Here, I am running it under Linux on my Thinkpad to check the speed of my hacked Pogoplug running ArchLinux on an ARM processor.
(To install iperf on the pogo, simply run Pacman manager: pacman -Sy iperf).
Jperf gives iPef a graphical UI layer if you don't want to mess with the console. You will simply need Java installed to run it.
As you can see in my screenshot, I am hitting the theoretical limits of Gigabit ethernet. My network is pretty clean and fast.
If your network switch supports jumbo frames, I suggest your try to take advantage of it. You would need to manually configure your network settings. And sometimes, it may not yield the perfect results so you will need to experiment.
I personally set my MTU to Jumbo Frames at 9000.
And how does my network perform? Different network protocol will yield different results. I ran some benchmarks to see which performed better. Different protocols will yield different results due to overhead. My testing was between my iMac and Macbook and my source was running off an SSD.
Samba/CIF was rather poor between two macs at 70 Megabytes per second.
NFS was a whole lot better than running Samba.
AFP (Apple File Protocol) performed the best;hitting Gigabits limits between macs.
Note, this type of scenario is not indicative of all use cases. In this particular setup, AFP was better suited between two macs. I'm sure SAMBA could have been tweaked to gain better performance. However, I am glad to know that my actual network hardware is capable of performing to its highest potential. Thus, this is why it is important to use tools like iperf.