Samba slow performance. Advice needed

Hi everyone,

I resolved or circumvented all issues I had in recent days regarding my 2.5Gbps network connection between storage server and desktop.
The disk array is a striped zpool that does 350 to 450MB/s easily. Both computers are connected with 2.5G NICs with a 2.5G switch in between and have plenty resources available. I tested iperf3 into both directions and receive stable ~2.36Gbps. I also copied a file over the network using rsync over ssh and received a stable transfer speed of ~230MBs:

rsync -r -v --progress -h -e ssh sapiens@server:/mnt/files/water.mkv /home/sapiens
receiving incremental file list
water.mkv
          1.86G   2%  252.13MB/s    0:03:53

The problem is Samba. I created a very simple share not doing any big modifications to the configuration. I mounted the share on the client using the file manager and when copying a file using the file manager I only get a little above 100MB/s. Using rsyncI only get about 70MB/s.

/etc/samba/smb.conf:

 [global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
   server string = %h server (Samba)


#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
   max log size = 1000

# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}.
# Append syslog@1 if you want important messages to be sent to syslog too.
   logging = file

# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller". 
#
# Most people will want "standalone server" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
   server role = standalone server

   obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<[email protected]> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
   pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user

############ Misc ############

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = no

server min protocol = SMB3

#======================= Share Definitions =======================

[storage]
  path = /mnt/files
  writeable = yes
  mangled names = no
1 Like

Sapiens,

Before we get too deep into this: don’t expect SAMBA’s performance to match SSH or rsync for transfers. Could you please post the configuration regarding your pool and datasets? Also, do you have the zfs-share service up and running?

Best regards,

vhns

1 Like

what cpu is in the host? single thread performance is important for samba.

server multi channel support = yes
aio read size = 1
aio write size = 1

try adding that to [global]

1 Like

Just to double check the obvious: When copying to and from a client, were you using a RAM disk or NVMe drive? Something that can definitely read and write over 250 MB/s ?

Also, was this a single file? Samba and Windows seem to do rather badly when copying directories of small files so don’t use that as a benchmark.

1 Like

What exactly do you want to know about the pool and dataset? I mean there is a lot of output possible. I have no other share services running and the computer is otherwise idle for now.

Ryzen 7 1700X

I will try and report back!

The transfer was tested with Samba and also with SSH, both times from the spinning rust to an NVME pool. The NVME pool is way faster than 250MB/s.

It was tested with one single around 60GB video file.

Sapiens

I want all the data! Muahahahahahaha!
On a serious note, could you please post the output of zpool get all and zfs get all from the pool and datasets you’re using for the share? Sometimes you could have settings that conflict with SAMBA and or reduce copy speed enabled. For zfs-share, a simple

systemctl status zfs-share

should be more than enough.

Best regards,

vhns

This did not help.

I however found out it has to do with the way the share is getting mounted on the client. I used Gnome Files to connect to the share and somehow I am unable to transfer more than 110MB/s using this connection method. I went out on a limb and created an cifs entry in /etc/fstabon the client and then ran mount -a to mount the new entry.

rsync --progress -h /mnt/files/water.mkv ~/
water.mkv
         34.87G  56%  276.31MB/s    0:01:35

It is important here that /mnt/files is the mountpoint of the cifs mount. Now it transfers perfectly fine! I am not sure what’s wrong here but I might file a bug report with the Gnome Files team tomorrow.

1 Like

I ran into this exact same issue years ago.

My solution was to use cli as the GUI never worked for me.

Gave up on samba and just used nfs.