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.
Table of Contents
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:
|Protocol||Version||Seq Read Speed||Seq Write Speed|
|AFP||N/A||649 MB/sec||306 MB/sec|
|NFS||v3 / v4||551 MB/sec||121 MB/sec|
|SMB||v1||161 MB/sec||169 MB/sec|
|SMB||v3||652 MB/sec||624 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+:
|Protocol||Version||Seq Read Speed||Seq Write Speed|
|AFP||N/A||1105 MB/sec||506 MB/sec|
|NFS||v3 / v4||590 MB/sec||156 MB/sec|
|SMB||v1||75 MB/sec||173 MB/sec|
|SMB||v3||1108 MB/sec||547 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.
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.
One thing I would like to add to this discussion from my personal experience using both protocols is this:
smb has much faster indexing speeds than afp.
When I vpn into my network remotely, and open a large volume (8tb) it can take 5-10 minutes to open a 2tb folder in afp, whereas the same folder opens in around 30s when using smb.
I have no empirical evidence of this, but in my environment (synology NAS, macbook) I notice a drastic difference in the time taken to open large folders and volumes.
How about 4k random write and read？
Are you using SSD in your NAS? I am concerned about your speeds, as no HDD is able to provide those.
Sequential speeds are rarely what people need when using network storage. Often you’ll want to favour IO/s on random accesses over raw read/write speeds, especially when doing incremental/differential backups or searches. I found (after lengthy experimentation) NFS to be very robust and super fast compared with its contenders, ranging around 350…450 IOps rather than the ~200 AFP and SMB manage.
Instead of copying a large file on a stopwatch, everyone should do real-world tasks for several weeks using one protocol and then the other and see for themselves. I experienced a big improvement in overall runtimes and snappiness after switching from AFP to NFS on my Synology box. This may well be due to the particular things I do, and everyone’s experiences may differ vastly, so do try it out applying your own personal workloads.
Re: the security concerns: If you manage to get into my storage network without my consent (meaning you have physically entered my house and hacked the switch to let your device in because storage is in its own wired LAN without a route to the internet), I shall have far greater worries than the security of my NFS shares. ;)
Thanks for writing this. Worth noting that with SMB I am unable to save the user login credentials. Using AFP, with synology box, the login is saved via Apple Keychain which makes reconnecting on bootup a lot smoother.
Great article and investigation, I found it very useful. I appreciate the more technical aspects, it was just the right level of technicality.
1. It feels to me in both NAS examples the transfer speeds were limited by the internal interfaces of the hard drives and the NAS. I would recommend to repeat the test with 3-4 SATA SSDs in Raid 0 to remove that limitation and to increase your throughput beyond the 10GbE connection.
You can check the internal throughput of the interfaces by dialing with SSH to the NAS, and running these commands (FS_Throughput is the closes to real-life file copy situation):
[~] # qcli_storage -T
[~] # qcli_storage -t
They gave results like this:
Performance test is finished 100.000%…
Enclosure Port Sys_Name Throughput RAID RAID_Type RAID_Throughput Pool
NAS_HOST 1 /dev/sda 538.48 MB/s /dev/md3 RAID 0 1.05 GB/s 3
NAS_HOST 2 /dev/sdb 522.25 MB/s /dev/md3 RAID 0 1.05 GB/s 3
NAS_HOST 3 /dev/sdc 407.47 MB/s /dev/md1 Single 417.48 MB/s 1
NAS_HOST 4 /dev/sdd 428.22 MB/s /dev/md2 Single 428.14 MB/s 2
Performance test is finished 100.000%…
VolID VolName Pool Mapping_Name Throughput Mount_Path FS_Throughput
1 DataVol1 1 /dev/mapper/cachedev1 393.04 MB/s /share/CACHEDEV1_DATA 397.52 MB/s
2 DataVol2 2 /dev/mapper/cachedev3 429.64 MB/s /share/CACHEDEV3_DATA 421.05 MB/s
3 DataVol3 3 /dev/mapper/cachedev4 1.07 GB/s /share/CACHEDEV4_DATA 1.02 GB/s
2. Make a little flowchart of how the devices were connected, which cards/interfaces and cables did you use. This could help to see where is the bottleneck, if any.
For example, a 10 GbE over Thunderbolt adapter has a limitation of ~600 MB/s.
3. For 10 GbE, SFP+ is much cheaper than 10GbaseT. There are a lot of sever pulled cards on ebay and aliexpress, with matching optical cables. 10GbaseT is still “new”, and so you have to buy most things new, and expensive. Also, instead of 3-4 mW, it works with 10-12 mW, and cards and adapters can get extremely hot.
The biggest problem these days with many working from home is SMB port 445 is blocked by many ISP’s. So they can’t reach out to Mac servers over SMB and have to use AFP. If their computer is on Catalina they are screwed. Apple breaks AFP in Catalina. So they either downgrade or upgrade to Big Sur, which surprisingly restored AFP to work properly.
Why not to use a vpn. I suggest you check Zerotier or Tailscale: both are awesome (and free) technologies, which provide virtual networks over internet. No matter from where you connect you’ll have a direct p2p secure network between all your devices. Just set it and forget ISP limitations, closed ports, etc…
NFS settings can be tweaked to increase performance. I have a thunderbolt (v2) bridge between two imacs, and NFS is giving me about 4Gb/s write speed. This was almost double my SMB test.
The problem with NFSv3 is that it is not very secure by default. So you really have to “trust” your network. Or go through the hassle of setting up NFSv4 and Kerberos.
Since I’m paranoid and lazy I use SMB because of the built in user auth.
Very true. However proper review and maintenance of your UGO keeps things secure. I’ve seen most set 777 and forget, the last octet should never be anything but 0 in most cases. All in all NFS is faster and I only wished OSX supported FS-CACHE however that’s NIX and OSX is BSD, well sorta BSD as it keeps morphing.
good article, thanks for sharing your findings.