Convalesco

Current revision: 0.5

Last update: 2018-11-04 07:56:25 +0000 UTC

Read not to contradict and confute; nor to believe and take for granted; nor to find talk and discourse; but to weigh and consider.

F. Bacon , The Essays - 1597 A.D.


Improving data transfers on MacOSX and ReadyNAS NV+

Date: 28/11/2010, 22:44

Category: technology



I’ve seen lot’s of questions and answers on the matter of data transfer speed from and to the ReadyNAS NV+. Since I bought one this week, I’ve been playing with it the entire week, trying to optimize it for home usage.

Speed is a major issue since the ReadyNAS NV+ acts as a server for many services that I run on the iMac and other computers or embedded devices.

There are different layers that can be optimized to improve data transfer speed, between the two. We will discuss about two (main) levels: hardware and software level.

Hardware

To get the most out of ReadyNAS NV+ who comes with Gbit ethernet, we need cat6 cables and Gbit ethernet on the computer along with a Gbit switch. The Gbit switch is a switch which supports Gbit ethernet(s), Jumbo frames and can provide speeds up to 100 MB/s (in theory). So in my case the hardware is:

One of the most usual reasons of low data transfer speeds between your mac and your Readynas is the switch. There are many ‘broken’ Gbit switches out there. Make sure you didn’t buy the cheapest.

Software

On the ReadyNAS NV+: I enabled AFP, OSX optimizations and Jumbo Frames. To achieve maximum data transfer speed you need to disable Journaling. Since the NAS is primarily a backup machine, I don’t see any reason for doing so. We get quite decent read/write speed with Journaling enabled so, my advice is to leave it there.

On the iMac: First, go to System Preferences -> Network -> Advanced -> Ethernet

Now set:

Configure: Manually

Speed: 1000baseT

Duplex: Full-duplex

MTU: Jumbo (9000)

Further explanation is in order here. We need to configure manually our Ethernet because MacOSX does not do the configuration automatically (as it should), even though it knows that we have plugged it a cat6 cable. The main reason is that most of our devices have small frames (meaning below 1500 MTU) and to them adding more MTU means nothing but extra pain and even lower speeds. The speed to 1000baseT means that our ethernet can handle 1000 Mbit/s.

The 'Duplex’ menu has two options: 'Full-duplex’ and 'Full-duplex, Flow Control’. We removed 'Flow Control’ option because it makes a control on TCP/IP level which is not required because the protocol does the control itself. TCP (Transmission Control Protocol) has this option implemented. I have no idea why Apple keep this 'on’ by default, but Windows and Linux has this option 'off’ by default. I’m not sure if WindowsXP and later support TCP Flow Control at all.

The Jumbo Frames are mega (Jumbo) transmission units (MTU). So we’re using the maximum transmission units. There is a 'theory’ that the best speed can be achieved if both parties and the switch have the MTU set in the exact same number, i.e. 7964. According to my tests, this is wrong. The ReadyNAS NV+ supports a maximum MTU (Jumbo Frames) of 7936. When I setup this number of MTU on the iMac (manually) I encounter a data transfer decrease of approximately 8 MB/s. So, the more the better! I take for granted that our Gbit switch supports even bigger MTU.

Now we’ll dig a bit deeper in OSX. I’ve take these options from FreeBSD geeks. OSX is a direct FreeBSD derivative and as such, it has all the positive force that drives the FreeBSD daemon!

You need to create a sysctrl.conf with these values:

atma@angel:~/ > cat /etc/sysctl.conf
net.inet.tcp.delayed_ack=1
net.inet.tcp.sendspace=2000000
net.inet.tcp.recvspace=2000000

The net.inet.tcp.delayed_ack=1 option will give you much extra speed. The default value is '3’ which is absurdly high. The value of '1’ is the most optimized for speed and security and is the default on FreeBSD. Setting this value to '0’ in theory increases speed but in practice, decreases (at least my) data transfer speed.

Epilogue

Using these options I get the following speeds over AFP protocol:

iMac -> ReadyNAS NV+ ~ 40 MB/s

ReadyNAS NV+ ->** iMac** ~ 59.4 MB/s

NOTE: In order to enjoy these high speeds, you need to transfer large files, i.e. mkv. The larger the better! For small single files  i.e. txt, mp3, etc. These speeds are rarely achievable, but also rarely needed. It’s a protocol level behavior, we can’t do much about it.

NOTE2: Disabling Journaling at the ReadyNAS NV+ will push the download data transfer above 60 MB/s. I’ve tested it :-).

These are pretty awesome speeds for a home cat6 network, enjoy!

UPDATE: Unfortunately I’ve been notified from twitter that for some weird reason the i7 and i5 iMacs do NOT support jumbo frames! That’s a pity and a - huge if you ask me - erroneous step for Apple!