Slow network transfers between Mac and Synology NAS
So, this post is a little different from my previous ones. It's not strictly about photography but it is about something I'm willing to bet is core too most photographers and something often taken for granted. Most of us have a workstation on which we run our digital darkroom, the Lightroom, Photoshop, Capture One etc apps and a lot of us will have a networked storage device on which we store photographs.
How many of us have considered the magic that allows these two devices to communicate? How many of us have had problems with slow file transfer speeds? How many of us realise we have a problem? Well, in this post I'd like to share a recent experience and how I nearly doubled the data transfer speed between my workstation and networked attached storage (NAS).
First off, let me be clear. This post is about your network. The thing that links your workstation to your NAS either directly or more probably via a network switch. I'm assuming the physical network uses cable(s) herein as, in my opinion, wireless (WiFi) is just too slow and error prone to transfer large amounts of data associated with raw image files. However, what is described below does equally apply to wireless networks. This post applies to Mac, Windows, Linux equally.
I've tried to keep this simple and avoid too much techie stuff so in places I've significantly 'glossed over' stuff and made some statements which are a bit liberal with the truth. This will probably annoy those folks who know better, but it's done so as this post is, hopefully, understandable to most non techie photographers.
These days, I shoot with a 50Mp Canon and if I stitch 2, 3 or sometimes 4 of those images together the resulting photograph can be in excess of 110M Bytes. That's not an insignificant amount of data to be pulling/pushing to a NAS and speed is really important the larger the images.
I recently became aware that Capture One on my iMac seemed to be taking much longer to display images and decided to investigate further. The end result showed that the issue was nothing to do with Capture One but more to do with my network configuration.A computer network has something called a Maximum Transmission Unit (MTU). You can read the wiki definition here, but for the purposes of this post it's the maximum amount of data that can be transferred in a single chunk across your network. The MTU is important because generally a larger MTU is associated with reduced overhead and a smaller MTU with reduced network delays. The MTU is usually obfuscated from users as its a pretty techie thing and if set wrong can cause significant performance issues....And that's why its the subject of this post. :-)
My network is a wired 1Gb or 1 Giga bit network which is not uncommon today. Given that there are 8 bits to a Byte that puts the theoretical maximum transfer speed between my workstation and NAS around 125MB (Mega Bytes) per second. Investigation showed I was achieving 65MB/s - very poor and no wonder it felt slow. Browsing the Internet I found posts identifying that some network protocols e.g. AFP or NFS - don't get bogged down in the names its not important to this post - allowed faster transfer speeds. So I tried these and yes there was some difference but nothing that would account for the 65MB/s rate. Other information on the Internet claimed Mac OS - as I'm using an iMac - had a broken implementation of the SMB protocol. Again this was a 'red herring' as we say in the UK and just not relevant.
Important to the investigation was the transfer of data between the workstation and NAS in a repeatable way. Pretty quickly I settled on the Blackmagicdesign Disk Speed Test application (Mac app store). This allowed 1GB to 5 GB sized files to be repeatedly transferred and the transfer time to reported.
Back to MTU. So, the commonly accepted 'rule of thumb' is that if a network is transferring lots or mostly big files/images then its better to have a larger MTU. It also works the other way too. If a network is mostly transferring lots of small files then a smaller MTU is desirable. The default MTU is normally 1500, 1516, perhaps 2000 Bytes but somewhere in that region. Many workstations and networked devices will let a much larger figure be specified; a figure of 9000 Bytes. Sometime in the past I had obviously applied that logic and configured my iMac and Synology DS415+ NAS to use an MTU of 9000 Bytes.
So why the terrible transfer speeds? First thing I did was return the iMac and Synology NAS back to their default settings. Wham, transfer speeds rose significantly. So, I tried different MTU sizes to establish which resulted in the highest transfer speeds. As you can see from the spreadsheet image, around 5000 seemed to be the smallest MTU that delivered the maximum transfer speeds. I chose the smallest MTU that gave that performance as a compromise between the transfer of large images and smaller office documents such as MS-Word, Excel etc
Some of the spreadsheet cells are empty for AFP and NFS protocols as having tested the low, middle and high MTU values I felt the results were sufficiently similar and thus testing them could be skipped.
I must stress at this point that no two networks are identical so yours might have very different characteristics. But if you are or think you are experiencing slow transfer speeds it would be worth investigating MTU sizes and their impact on performance. The really interesting finding in my results is that performance drops off a 'cliff' at 9000 bytes on my systems. This is not what I would have expected and seems counter-intuitive.
So, the take-away is:
Test your network transfer speed and if it does not seem right - investigate
Don't blindly set your MTU's without performance testing as the 'rule of thumb' may not be appropriate for your network
Try tweaking the MTU sizes and record the results. They can easily be returned to their former values
Posts about Mac OS and broken SMB implementations don't apply to Mojave
There is little difference with Mac OS Mojave between SMB, AFP and NFS.
The images below show the configuration windows on the iMac workstation and Synology NAS where the MTU is set. Click on them to view at larger size.
Addendum 15-Nov-2018
Just thought I'd add that a NAS, even connected on a 1Gb network is way, way slower than using a local disk, especially a Solid State Drive (SSD). Compare the transfer speeds in either the Excel spreadsheet above or the image at the very top of this post with that below captured from a speed test of my local SSD. The take-away is that a NAS is great for storing images, asset management even doing a little image processing. But when developing/processing images and need to shift large volumes of data the best way is to copy the image being worked from the NAS to local SSD storage, work on it there and when done move it back to the NAS. Just remember that a NAS with an array of disks will provide protection against one or more disk failures and thus your images are better protected on a NAS than sat on a local disk/SSD inside your workstation. Just a note that whilst the proceeding sentences are true they are generalisations. A NAS can be configured in many ways and usually provide protection against disk failure but they can be configured to not do so too.....