You are not logged in.

#1 2015-05-28 07:41:12

Aleš
Member
Registered: 2015-05-28
Posts: 4

[SOLVED] SAMBA slower for file smaller than 4GB

Hi there!
I'm using Arch several years but never need to ask until now. My samba server is on Arch, client is on Arch as well. Both are sitting on 1Gb network. Transfer rates for writing files bigger than 4GB is 50MiBps which is maximum capability of the disk in server. But rates for smaller files are stuck at 9.5MiBps. I don't know where exact threshold is but 1.6GB file and smaller goes at 9.5MiBps and 4.5GB file and bigger goes at 50MiBps. I have tried to play with smb.conf, searched internet of course but did not found the reason of this behavior. Maybe it is something obvious but I can not see it. Could anyone help me please?

My smb.conf is:

[global]
        workgroup = MYGROUP
        netbios name = %H
        server string = Samba Server
        map to guest = Bad User
        guest account = player
        log file = /var/log/samba/%m.log
        max log size = 50

        load printers = No
        printing = bsd
        printcap name = /dev/null
        disable spoolss = Yes
        show add printer wizard = No

        dns proxy = No
#============================ Performance tuning ============================

        socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_SNDBUF=262144 SO_RCVBUF=262144
        keepalive = 60
        strict allocate = Yes
        min receivefile size = 16384
        aio read size = 16384
        aio write size = 16384
#============================ Share Definitions ==============================
[share]
       path = /srv/share
       read only = No
       guest ok = Yes

I'm mounting share with this command:

sudo mount -t cifs -o guest,x-systemd.automount,uid=luser,gid=users,file_mode=0777,dir_mode=0777,cache=none -v //192.168.1.100/share/ /mnt/share/

Last edited by Aleš (2015-05-29 18:44:26)

Offline

#2 2015-05-28 12:04:31

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: [SOLVED] SAMBA slower for file smaller than 4GB

What are you transferring your files with? The file managers on linux often struggle with smaller files, worst offender so far being dolphin. See my test here.

I'm using a smaller send/receive buffers and my transfer speeds are around 60MiB/s for ~200Mb files and up. The 13k small files as tested in the thread linked above take a long time even when copying via console, 935KiB/s.

My settings:

socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 IPTOS_LOWDELAY TCP_NODELAY
 min receivefile size = 16384
 use sendfile = true
 aio read size = 16384
 aio write size = 16384

[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#3 2015-05-28 15:20:03

Aleš
Member
Registered: 2015-05-28
Posts: 4

Re: [SOLVED] SAMBA slower for file smaller than 4GB

Wow, it seems you hit the nail on the head. Thank you very much for your response!

I'm using krusader for transferring my files normally. I have just tried to use pcmanfm and the result was slow rates (9.5MiBps) for both mentioned file sizes. Then I tried cp in command line and it was fast (50MiBps) even for 400MB file. It seems to me that krusader use another algorithm for extremely big files.

I have tried settings you posted earlier but sendfile option does not have any effect in my case and smaller socket buffer size caused slightly lower transfer rates for those "extremely" big files.

Offline

#4 2015-05-28 15:39:02

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] SAMBA slower for file smaller than 4GB

You can use the script I wrote and do some time tests (just mod it to vary the file size to your liking): https://bbs.archlinux.org/viewtopic.php?id=188613


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2015-05-29 18:39:58

Aleš
Member
Registered: 2015-05-28
Posts: 4

Re: [SOLVED] SAMBA slower for file smaller than 4GB

Mistery solved.

Thank You everybody involved!

I used option cache=none for cifs year or two ago for a reason which I do not remember yet :-). I underrated my disk also - it has about 120MBps write rates according to tests on the net. I ended up with settings below and I'm seeing transfer rates about 90MiBps for file sizes from 400MB (I didn't tested smaller). This is close to gigabit network limit and it is absolutely perfect for me!

smb.conf:

[global]
        workgroup = MYGROUP
        netbios name = %H
        server string = Samba Server
        map to guest = Bad User
        guest account = player
        log file = /var/log/samba/%m.log
        max log size = 50

        load printers = No
        printing = bsd
        printcap name = /dev/null
        disable spoolss = Yes
        show add printer wizard = No

        dns proxy = No

#============================ Performance tuning ============================

        socket options = TCP_NODELAY IPTOS_LOWDELAY
        min receivefile size = 16384
        aio read size = 16384
        aio write size = 16384

#============================ Share Definitions ==============================
[share]
       path = /srv/share
       read only = No
       guest ok = Yes

mount command:

sudo mount -t cifs -o guest,x-systemd.automount,uid=1000,gid=1000,file_mode=0660,dir_mode=0770 -v //192.168.1.100/share/ /mnt/share/

Last edited by Aleš (2015-05-29 18:42:43)

Offline

Board footer

Powered by FluxBB