Skip to main content

Enhancing macOS SMB Network Share Performance

In my quest to build the ultimate home server, I recently constructed a new Network Attached Storage (NAS) system with powerful hardware and abundant storage capacity. The goal was to create a versatile and efficient home server capable of saturating Gigabit network speeds consistently for both read and write operations. While I achieved the expected results on my Linux and Windows machines, my macOS-based laptop struggled to achieve satisfactory speeds. I’ll share my experiences and the optimizations I employed to overcome the performance limitations on my Mac.

Benchmarks indicated that my NAS was more than capable of delivering the read and write speeds I hoped for, consistently saturating my Gigabit network (1 Gbit/s = 125 MB/s) with net transfer speeds reaching more than 110 MB/s. It all worked like a charm on my Linux and Windows machines, but the story took an unexpected turn when I tried it on my MacBook.

Upon connecting my Mac to the Samba share on the NAS, the transfer speeds plummeted dramatically. Instead of the at least a 100 MB/s for large files I expected, the speeds crawled down to less than 10 MB/s. Often it was just unusable. Whether dealing with a single large file or multiple small ones, the difference was negligible. The sluggishness also persisted on both Wi-Fi and LAN, Wi-Fi performed just even worse.

What’ s going on with SMB shares on macOS?

After some research, I found the culprit behind the bad performance: macOS’s support for the SMB (Server Message Block) protocol is by far not as robust as desired. The Samba version packaged with macOS is outdated, and the default configuration is not optimized for good performance. Determined to find a solution, I went deeper into the rabbit hole and tried to fix the issues.

Optimization 1: Disable Package Signing

macOS, by default, requires package signing to bolster security. However, this comes at a cost to performance. One option to improve speeds is to disable package signing entirely. But, after testing, I found that the performance increase was minimal and not worth the potential security risks to me. I opted to retain the default setting to maintain a more secure environment.

printf "[default]\nsigning_required=no\n" | sudo tee /etc/nsmb.conf >/dev/null

or edit /etc/nsmb.conf manually:

[default]
signing_required=no

Reference: https://support.apple.com/en-gb/HT205926

Optimization 2: Disable Delayed TCP ACK

This is the big one! The kernel setting that had a significant impact on performance was disabling delayed TCP ACK. As the Samba protocol is highly communicative and involves multiple handshakes all the time, pooling them together can slow down data transfers. Disabling delayed ACK instantly improved transfer speeds and finally unleashed my NAS’s full potential on macOS.

sysctl -w net.inet.tcp.delayed_ack=0

Optimization 3: Disable .DS_Store Files on Network Shares

Although transfer speeds were now back on track, I still noticed sluggishness while browsing directories on my Mac. Loading file lists and previews took ages, especially for media-heavy directories. This was caused by macOS writing and reading .DS_Store files, used for directory listings and previews. To fix this, I deactivated the .DS_Store files on network shares.

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

Reference: https://support.apple.com/de-de/HT208209

Alternative: Disable SMB Directory Cache

Another optimization for the Samba client involves disabling the directory cache. This further accelerates browsing speeds, ensuring a seamless and pleasant experience while navigating directories.

edit /etc/nsmb.conf and add:
[default]
signing_required=no

With these optimizations in place, my Mac’s performance on the NAS finally got close to levels achieved on my Linux and Windows machines. Troubleshooting slow NAS speeds on macOS can be daunting, but with a little research and the right tweaks, you can overcome the hurdles and unleash the full potential of your networked storage.

DevOps, macOS