You are not logged in.

#1 2016-04-16 12:28:45

Enverex
Member
From: UK
Registered: 2007-06-13
Posts: 159
Website

Terrible Samba Performance

Preamble: The client is running through a WiFi bridge (Client > Ethernet > WiFi Bridge > WiFi Router > Switch > Server) which I initially attributed the bad performance, but it turns out the connection itself is just fine. I tried copying a large test file via SFTP instead and got a solid 36MB/s. Client is a Windows 10 machine.

I've had Samba running for a long time and I remember a good while ago it was perfectly fine, but when trying to copy a large file today I noticed the speeds were outright atrocious. It generally bounced around 1MB/s, dipping to ~350KB/s and peaking at maybe 1.7MB/s at most. I'm not using any special "speed" options. I did long ago but had disabled them as they seemed to do more harm than good. I tried uncommenting them to see if that helped, but no real change.

Here's my current config as parsed by testparm...

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[Media]"
Processing section "[Root]"
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        bind interfaces only = Yes
        interfaces = br0 lo
        server string = Home Server
        domain master = No
        local master = No
        preferred master = No
        log file = /var/log/samba/samba.log
        max log size = 50
        load printers = No
        printcap name = /dev/null
        name resolve order = hosts bcast
        unix extensions = No
        map to guest = Bad User
        pam password change = Yes
        security = USER
        unix password sync = Yes
        dns proxy = No
        idmap config * : backend = tdb
        hide dot files = No
        mangled names = No
        veto files = /lost+found/
        wide links = Yes
        hosts allow = 127.0.0.1 10.0.0.50/25
        hosts deny = 0.0.0.0/0
        vfs objects = btrfs

So, any ideas? Server machine is up-to-date as of this morning.

Offline

#2 2016-04-16 13:09:46

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

Re: Terrible Samba Performance

Do we know that the speedometer within scp and whatever you're using on the windows side (windows explorer?) are measuring the throughput consistently?  What if you make a new file on the linux side (one that can't be cached) and time it using a physical stopwatch using scp and then make a new file of the same size and time it using samba.  Are they ballpark (within 2-3 fold)?  Repeat a number of times using each method.

You can use this code to make a random file that is 1100 M.  You will need to install parallel.  You can redefine TMPFS= to a space that is in fact a tmpfs on the linux side to avoid HDD usage during the generation of the file if you want.  Note that systemd will take 1/2 your physical RAM and mount it to /tmp so if you have >4G just use /tmp.

#!/bin/bash
TMPFS=/tmp
NOW=$(date +%s)
# make 1100 M file assembled from 3x10M files in in a pseudo random fashion

for i in {0..109}; do
	RND=$(echo $[ 1 + $[ RANDOM % 3 ]])
	Array[$i]=$TMPFS/chunk$RND
done

parallel "dd if=/dev/urandom of=$TMPFS/chunk{} bs=1M count=10 &>/dev/null" ::: 1 2 3
cat ${Array[@]} > $TMPFS/testfile-$NOW
rm chunk1 chunk2 chunk3

That script will give you an 1100 M file named something like "testfile-1460812160" which you should use to test scp.  After you do that, delete that file and generate a new one (again, they will be unique so no caching can affect the results). Now transfer the new one by samba.  How long did each take?

Last edited by graysky (2016-04-16 13:13:09)


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

Offline

#3 2016-04-16 14:20:21

Enverex
Member
From: UK
Registered: 2007-06-13
Posts: 159
Website

Re: Terrible Samba Performance

I'm copying the file FROM the client to the Samba server so it can't be caching. The server's also using an SSD for my speed tests so that shouldn't be an issue.

Offline

#4 2016-05-05 09:00:38

Enverex
Member
From: UK
Registered: 2007-06-13
Posts: 159
Website

Re: Terrible Samba Performance

Bump. This is still an issue unfortunately. 36MB/s over SFTP, but only around 700KB/s via Samba (to the same folder on the server).

Offline

Board footer

Powered by FluxBB