Slow Samba speed 20MB/s with 1Gbit NIC

Hello, I have super slow SMB speed that is around 20MB/s only (MacBook to NAS), here is my settings:

  • NAS with 1 Gbit NIC that wired to wifi router, cable is CAT5 now replaced with CAT6
  • Wifi router’s interface that connected to NAS is also 1Git/s
  • Wifi router is Redmi AX3000 that supports wifi 6
  • M1 Macbook supports wifi 6 too

Hereby is the samba settings:

cat /usr/local/etc/smb4.conf
[global]
    unix charset = UTF-8
    workgroup = WORKGROUP
    realm = home
    netbios name = Rob
    interfaces = bge1 192.168.31.0/24 127.0.0.1
    bind interfaces only = yes
    hosts allow = 192.168.31.0/24
# recommended fruit config for MacOS
    vfs objects = fruit streams_xattr  
    fruit:aapl = yes
    fruit:metadata = stream
    fruit:model = MacSamba
    fruit:veto_appledouble = no
    fruit:nfs_aces = no
    fruit:wipe_intentionally_left_blank_rfork = yes 
    fruit:delete_empty_adfiles = yes 
    fruit:posix_rename = yes
    spotlight = no
    ea support = yes
    min protocol = SMB2
# performance tunning reference 
# https://hilltopsw.com/blog/faster-samba-smb-cifs-share-performance/
# https://github.com/jazzi/Quicker-macOS-SMB/blob/main/Quicker-macOS-SMB.sh
# https://fy.blackhats.net.au/blog/2021-03-22-time-machine-on-samba-with-zfs/
# https://serverfault.com/questions/999920/very-slow-smb-speeds-on-macos
# The following three lines can be put into /etc/nsmb.conf of MacOS client
#
## signing_required = no
## protocol_vers_map=6
## port445=no_netbios
#
    strict allocate = Yes
    allocation roundup size = 4096
    read raw = YES
    server signing = No
    write raw = Yes
    strict locking = No
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
    min receivefile size = 16384
    use sendfile = Yes
    aio read size = 16384
    aio write size = 16384

Just tested the speed with command iperf3:

iperf3 -c 192.168.1.240
Connecting to host 192.168.1.240, port 5201
[  5] local 192.168.31.201 port 54572 connected to 192.168.31.240 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  47.4 MBytes   395 Mbits/sec                  
[  5]   1.00-2.00   sec  51.0 MBytes   429 Mbits/sec                  
[  5]   2.00-3.01   sec  50.4 MBytes   422 Mbits/sec                  
[  5]   3.01-4.00   sec  50.4 MBytes   424 Mbits/sec                  
[  5]   4.00-5.00   sec  51.5 MBytes   432 Mbits/sec                  
[  5]   5.00-6.00   sec  51.9 MBytes   435 Mbits/sec                  
[  5]   6.00-7.00   sec  50.2 MBytes   422 Mbits/sec                  
[  5]   7.00-8.00   sec  51.5 MBytes   432 Mbits/sec                  
[  5]   8.00-9.00   sec  49.8 MBytes   417 Mbits/sec                  
[  5]   9.00-10.01  sec  47.4 MBytes   396 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.01  sec   501 MBytes   420 Mbits/sec                  sender
[  5]   0.00-10.03  sec   501 MBytes   419 Mbits/sec                  receiver

iperf Done.

According to another post presented by @SmallBarky ,his speed for 1 Gbit NIC is 3 times than mine.

Is this 20MB/s speed normal?

Hi and welcome to the forums.

Let’s start with the specs of your NAS please that’s always really helpful info. Focus on CPU, RAM, HDD/SSD, how many and pool layout etc.

Also how did you do your testing to come to the conclusion that you are limited to 20MB/s? Was that reads and/or writes?

Looks like your theoretical max is around 50MB/s based on your iperf test and what with overhead I’d say we’re shooting for about 40MB/s tops. Bear in mind the type of data you are moving will impact this. Nice big files 4GB plus will always be faster than lots of little files by some margin so always best to test with big stuff first I find.

You are about at half the speed I get over wired 1Gbps. If you are running over wireless, that may be about right. Can you try your test with wired only?

The speeds you saw may have been over a 10Gbps with a single hard drive on transfer.

2 Likes

Are you running wireless ?

Can you try to test speed with a wired connection ?

Thanks for the info, unfortunately all my laptops can not wired to the router.

@Johnny_Fartpants My NAS is HPE MicroServer Gen10, it’s quite old but I heard it’s very stable, anyway here is the profile:

  • CPU: Opteron X3216 1.6G
  • GPU: Integradted AMD Radeon 7
  • RAM: ECC DDR4 UDIMM 8GB, could upgrade to 16G * 2
  • NIC: Broadcom 5720 Gigabit Ethernet * 2
  • SATA: LFF/SFF SATA 6Gb/s * 4 + SSD SATA * 1
  • PCIe: PCIe3 x 8 and PCIe3 x 4
  • USB: USB 2.0 * 3 and USB 3.0 * 3
  • VIDEO PORT: VGA * 1 plus DP * 2
  • POWER: 200W

And I test the speed with command dd as well as rsync, ever trid big 2G files as well as hundred 4-5M small files. Sometimes I just used the timer to calculate the speed manually no matter write or read.

Just upgraded my router from Redmi AX3000 to ZTE AX5400Pro, the WIFI speed increased to 5400Mbps from 3000Mbps, so now here is the new test with ZTE AX5400Pro

iperf3 -c 192.168.31.240
Connecting to host 192.168.31.240, port 5201
[  5] local 192.168.31.201 port 53284 connected to 192.168.31.240 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  46.6 MBytes   389 Mbits/sec                  
[  5]   1.00-2.00   sec  60.6 MBytes   509 Mbits/sec                  
[  5]   2.00-3.00   sec  61.2 MBytes   514 Mbits/sec                  
[  5]   3.00-4.00   sec  61.1 MBytes   513 Mbits/sec                  
[  5]   4.00-5.00   sec  65.4 MBytes   548 Mbits/sec                  
[  5]   5.00-6.00   sec  60.5 MBytes   508 Mbits/sec                  
[  5]   6.00-7.00   sec  60.6 MBytes   509 Mbits/sec                  
[  5]   7.00-8.00   sec  60.6 MBytes   509 Mbits/sec                  
[  5]   8.00-9.00   sec  58.4 MBytes   490 Mbits/sec                  
[  5]   9.00-10.01  sec  65.0 MBytes   545 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.01  sec   600 MBytes   503 Mbits/sec                  sender
[  5]   0.00-10.01  sec   600 MBytes   503 Mbits/sec

As you can see, the bandwidth speed is about 10MB/s improved and now the Samba speed is about 26MB/s, comparing 20MB/s before, it has 6MB/s improved but still it’s quite slow.

This ZTE AX5400 Pro has a 2.5Gbps interface, I plan to add a 2.5Gbps NIC PCIe to the NAS, thus to have 2.5Gbps connection between NAS and WiFi Router.

The ZTE AX5400 Pro costs $55 and UGREEN PCIe 2.5Gbps card costs $10, it deserves a try.

You are not even hitting 1Gbps. Why would you even try to upgrade to 2.5Gbps?

Thanks for the hinting. Just found Windows 10 client has a speed around 45MB/s, it is much faster than MacOS, so I dig a little bit and found many complains on MacOS.

Hereby is my MacOS settings:

cat /etc/nsmb.conf

[default]
dir_cache_max_cnt=0
signing_required=no
streams=yes
notify_off=yes
port445=no_netbios
unix extensions = no
veto files=/._*/.DS_Store/
protocol_vers_map=6
mc_prefer_wired=yes
mc_on=no

Also tried sudo sysctl -w net.inet.tcp.delayed_ack=0 on MacOS.

No big difference.

Why are you editing the smb.conf so much? A lot of your changes are invalid.

For example:

vfs objects = fruit streams_xattr  

breaks ACL support and various other aspects of our SMB server.

1 Like

Switching off delayed acks wont give you any performance benefits at all.

Its an advice from 10 years ago

Right. Most of these things are old performance tuning voodoo.

Thanks for the question, I get those settings from the samba wiki.

The wiki does not apply since you are not deploying samba on a generic linux distro.

Question are you talking about moving files or accessing things via the finder? The finder is a known issue.

MacOS is just slow with SMB in the finder. It is not TrueNAS. All my Macs are slow and Windows boxes are fast. There are a few things that will speed things up a bit.

Finder > View > Show View Options and turn Show icon preview and preview column off. Please note this is not per folder so it turns it off everywhere.

Turn off writing of .DS_Store files

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

For the file move speed you can turn off encryption required in TrueNAS and turn it off on the Mac. Understand that the files will not be encrypted on the wire and more.

❯ cat /etc/nsmb.conf

[default]
mc_on=yes
mc_prefer_wired=yes
signing_required=no
dir_cache_off=yes
dir_cache_async_cnt=0
dir_cache_max_cnt=0
dir_cache_max=0
dir_cache_min=0

Also I am a bit confused as you are talking about SMB but testing with iperf3? What issue are we trouble shooting? SMB access or basic network throughput?

If you have a speed mis-match between the testing host you will drop packets before TCP backs off. Also confused about the connection. Is it wired or wireless? Wireless is a crapshoot.

Thanks for the info, then what’s the recommended TrueNAS/FreeBSD samba settings for MacOS client?

Thanks for the help. It’s wireless connected from macOS to wifi router, I know wireless is a crapshoot but no other option. Here is the map:

NAS ----- (1Gbps) ------ WiFi Router ---- (5400Mbps wifi6) ------ MacOS wifi

Also found someone has a MacOS specific settings for Samba server:

In my smb.conf file, as part of the [Global] section, I include some tweaks alleged to make macOS performance better:

fruit:aapl = yes
fruit:model = MacSamba
vfs objects = catia fruit streams_xattr
fruit:nfs_aces = no
fruit:zero_file_id = yes
fruit:metadata = stream
fruit:encoding = native

And, in the definitions for each share I also include:

veto files = /._*/.DS_Store/
delete veto files = yes

(This are more for my sanity than anything else…)

Yes, the forums accumulates lots of suspect guidance. The defaults we have are there for a reason generally.

Good news, just improved the wifi speed to 60MB/s and 80MB/s on windows client. Hereby is the settings on Server.

cat /usr/local/etc/smb4.conf           
[global]
    unix charset = UTF-8
    workgroup = WORKGROUP
    realm = yohoho.home
    netbios name = Rob
    interfaces = 192.168.31.0/24 bge1 127.0.0.1
    bind interfaces only = yes
    hosts allow = 192.168.31.0/24
# recommended fruit config for MacOS
    vfs objects = catia fruit streams_xattr  
    fruit:aapl = yes
    fruit:metadata = stream
    fruit:model = MacSamba
    fruit:zero_file_id = no
#    fruit:veto_appledouble = no
    fruit:nfs_aces = no
#    fruit:wipe_intentionally_left_blank_rfork = yes 
#    fruit:delete_empty_adfiles = yes 
#    fruit:posix_rename = yes 
    fruit:encoding = native
    readdir_attr:aapl_rsize = no
    readdir_attr:aapl_finder_info = no
    readdir_attr:aapl_max_access = no

    strict allocate = no
    strict sync = yes
    read raw = yes
    write raw = yes
    strict locking = Auto
#    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
socket options = TCP_NODELAY IPTOS_LOWDELAY
    min receivefile size = 32768
    use sendfile = Yes
    aio read size = 1
    aio write size = 1

Did you set this to yes? If so any particular reason? This alone could be slowing you down.

There are some words on the Samba documentation as below:

Only consider changing this if smbd is serving obsolete SMB1 Windows clients prior to Windows XP (Windows 98 and below). There should be no need to change this setting for normal operations.

Default: strict sync = yes

That’s the reason I set it to yes.