AFP vs NFS vs SMB Performance on macOS Mojave

If you are a Mac user, you might be wondering which file-sharing protocol gives the best performance when using a network-attached storage device (NAS) such as Synology, or a NAS / Thunderbolt over Ethernet device such as QNAP. With macOS allowing one to choose between AFP, NFS, SMB and CIFS protocols, it is sometimes tough to make the proper choice, especially considering that some of these protocols have different versions that might perform differently. Add to this the fact that macOS itself might behave differently depending on which version of it you are running, and it can get quickly aggravating for many photographers out there who are simply trying to get the best out of their equipment.

I am currently in the process of reviewing another QNAP device, and while at it, I decided to test out all these protocols on the latest version of macOS Mojave 10.14.3 on my iMac Pro that has a built-in 10 GbE connection. The 4-bay QNAP device offers both Thunderbolt over Ethernet and 10 GbE connectivity options, so I tested both, although it turned out that Thunderbolt offered better overall performance, which is why I decided to stick with it instead of 10 GbE. In order to make sure that the 4-bay QNAP device performs at its maximum potential, I used fast 7200 RPM 4x WD Red drives configured in RAID 0 configuration. File System Analyzer within QNAP Diagnostic Tool showed that the volume’s potential was roughly 680 MB/sec read speed and 570 MB/sec write speed, which is pretty decent for four drives in RAID 0 configuration (with each drive potentially being able to do up to 180-190 MB/sec, according to HDD Analyzer). Nothing was changed on the iMac Pro from the configuration standpoint, with default /etc/nfs.conf, /etc/nsmb.conf and /etc/sysctl.conf files (if you are running an older version of macOS, you should edit the /etc/nsmb.conf file and make sure to add “signing_required=no” to the file or your transfer speeds with the SMB protocol will suffer greatly).

To make sure that my data is a bit more accurate and not just localized to a single NAS system, I also ran a similar test on an 8-bay Synology DS1817+ NAS with 10 Gbit connectivity that I reviewed last year. The Synology drives are in RAID 6 configuration, using 6 TB HGST 7200 RPM drives. Since Synology DS1817+ does not have a Thunderbolt connection, all tests were performed over 10 Gbit network. To make sure that I can get the maximum potential network speed, the iMac Pro, the Synology DS1817+, as well as the 10 GbE network switch were configured for 9000 MTU Jumbo frames. Let’s do a quick overview of each file sharing protocol and we will get down to comparisons and conclusions right after.

What is AFP?

AFP, which stands for Apple Filing Protocol, is a proprietary network protocol that was developed as part of the Mac Operating System. It was originally known as AppleTalk, but was later changed and renamed to AFP. Because it is native to macOS, it is the most compatible and the most feature-rich among all supported network protocols. It has built-in support for “Spotlight” search, Time Machine, Mac Aliases and Bonjour Services, which other protocols are not compatible with.

What is NFS?

Network File System (NFS) is a distributed file system protocol that was developed for use in Unix / Linux operating system environments. It is based on an open standard and has gone through a number of revisions and contributions from the Unix / Linux community over the years, from version 2 (NFS v2) all the way to the latest NFS version 4.2 that was published in 2016. Most modern implementations of NFS are based on version 3 and 4 of the protocol, with some systems providing support for 4.1 and now 4.2. macOS natively supports NFS v3 and NFS v4, although the support for version 4 needs to be manually enabled through the /etc/nfs.conf file, since the operating system connects to version 3 by default.

What is SMB / CIFS?

The Server Message Block (SMB) is a network file sharing protocol that was developed by Microsoft, while Common Internet File System (CIFS) is one of its versions. Similar to AFP, SMB / CIFS were developed as native protocols for the parent operating system Microsoft Windows. SMB also provides some specific features, such as network printing, shared folder authentication, file locking, etc. macOS has built-in support for SMB 1 / CIFS, SMB 2, as well as SMB 3.

In short, think of the three as Apple, Unix and Windows protocols. Each has its list of pros and cons, but for Mac users, AFP is typically the route to take.

AFP vs NFS vs SMB / CIFS Performance Comparison

Now that you understand the main differences between these protocols, let’s take a look at how they all compare when dealing with a lot of network and Thunderbolt traffic. Take a look at the below table that summarizes performance results I got from the 4-bay QNAP NAS / DAS:

ProtocolVersionSeq Read SpeedSeq Write Speed
AFPN/A649 MB/sec306 MB/sec
NFSv3 / v4551 MB/sec121 MB/sec
SMBv1161 MB/sec169 MB/sec
SMBv3652 MB/sec624 MB/sec

I ran a total of 5 tests for each protocol and version and picked the best result.

As you can see, the worst performer here is NFS. While it did a decent job with read speeds, averaging around 551 MB/sec over 3 tests using a 4 GB file (with AJA System Test Lite benchmark tool), its write speed was quite terrible at 121 MB/sec. Despite the fact that AFP is a native macOS protocol, it was also disappointing in terms of write performance on the QNAP, although reading speeds were excellent. The top performer here is SMB v3 – I was able to get 652 MB/sec read and 624 MB/sec write speeds using this protocol, which was quite impressive. SMB v1 / CIFS is quite terrible overall, showing very poor read and write speeds, so it should be avoided at all costs.

Here is the screenshot from AJA System Test Lite for the above SMB v3 result:

And here is the screenshot for the AFP result:

After running these tests, I realized that perhaps the QNAP implementation of AFP was just poor, so I decided to repeat the same tests on a Synology NAS. Below is the summary of results from running the same test on the Synology DS1817+:

ProtocolVersionSeq Read SpeedSeq Write Speed
AFPN/A1105 MB/sec506 MB/sec
NFSv3 / v4590 MB/sec156 MB/sec
SMBv175 MB/sec173 MB/sec
SMBv31108 MB/sec547 MB/sec

The Synology DS1817+ was able to get faster read speeds due to having more physical drives and as you can see from the above table, I was able to get over 1.1 GB/sec speeds using both AFP and SMB v3 protocols. However, the situation is a bit different when it comes to write speeds. Similar to the first table, the top performer was again SMB v3, demonstrating excellent read and write performance. AFP performed better on the Synology NAS compared to QNAP, but still lagged behind by between 50-75 MB/sec. I re-ran the tests several times with both 4 GB and 8 GB sequential read / write operations and the results were still pretty consistent, placing SMB v3 above AFP in general. SMB v1 should be avoided like a plague on the Synology – I could not get more than 75 MB/sec read speeds, which basically demonstrates that the implementation of this version is probably buggy.

Conclusion

Based on what I see from two different NAS vendors, it looks like SMB v3 is the best network protocol one can use in terms of overall performance on macOS, with AFP being the second best. Both SMB v1 and NFS should be avoided – they demonstrated rather disappointing write performance. If specific macOS features that AFP provides are important to you, then you should test both SMB v3 and AFP on your NAS device and see how each does on its own. For Synology, it looks like the performance differences are not very noticeable, but for anyone who uses a QNAP device, AFP robs almost half of the write speed, which is just too much…

I know this article is probably a bit too technical for our readers, but I still wanted to share it, as I believe one should use the best tool for the job. If you use a NAS in your environment, it would be great if you could share your results using similar tools in the comments section below.

Exit mobile version