SMB performance and disconnects

bigpal
edited December 2020 in SecuritySpy
I've been having problem with samba (SMB) shares since Apple started favoring them over AFS several MacOS releases ago. With Catalina and Big Sur, the performance has been sub-par and the disconnects have been almost daily. My SS setup writes captures to a NAS (QNAP RAID 5) I have on the local network, yet I was seeing the SMB shares disconnect and SS was writing captures to my local "Captured Files" folder. Very frustrating. I knew it wasn't SS because of the history with SMB on Macs.

I found a nvram setting for improved performance. This command enables "server performance mode" which many users have noticed eliminates the disconnects and increases network performance. Make sure you run this command in zsh (didn't work for me in tcsh). If you're not sure, type "echo $SHELL" or "env|grep SHELL" at the terminal command line and it will tell you what shell you're using. To use zsh just type "zsh".

A caveat - I would not enable this unless you want your Mac running like a server. I have an M1 mini running like a server, all it does is run home automation scripts, serve video, media, etc. Use at your own risk. This changes quite a few kernel parameters dealing with memory, networking, sharing, timeouts, etc. I've confirmed it still works on Big Sur and the ARM processors. It will allocate more kernel resources for server-type duties and less to the "desktop" type. Also, reboot after changing this setting.

Enable server performance mode:
sudo nvram boot-args="serverperfmode=1 $(nvram boot-args 2>/dev/null | cut -f 2-)"

Disable server performance mode:
sudo nvram boot-args="$(nvram boot-args 2>/dev/null | sed -e $'s/boot-args\t//;s/serverperfmode=1//')"

Comments

  • This is very interesting, thanks for posting. To confirm, have you found that making this settings change alone has resolved the connection issues with the NAS?