Samba is extremely slow on WRT1200AC with 17.01-rc2

I tested the read speed of NFS, Samba and SFTP on lede 17.01-rc2 over 11ac WLAN.

When copying the same file from a ext4 file system on the router to my laptop, NFS gives ~30MB/s, SFTP gives ~10MB/s, while Samba gives only ~3MB/s :disappointed_relieved:. And a peculiar thing is that the CPU usage is very low with Samba.

I am using the default configuration for both services. Could anyone point out a way to troubleshoot?

Update:

Thanks to weedy, I tested the transfer speed on Ethernet. It is approx. 50MB/s. Is there anything in the wireless driver that prevents samba to reach a higher speed?

Try this

# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details
socket options = TCP_NODELAY SO_KEEPALIVE IPTOS_LOWDELAY
use sendfile = Yes
aio read size = 4096
aio write size = 4096

These might not work with the samba version we ship.

# No NTLMv1, force NTLMv2
ntlm auth = no
client ntlmv2 auth = yes
client use spnego principal = no
client max protocol = SMB3
server max protocol = SMB3
1 Like

Thank you. I added the the settings to /etc/samba.smb.conf.template and restarted samba. But there seems little improvement in terms of upload and download speed.

Can you SSH and run "top -d2" at the same time? Is something like softirq eating all the CPU?

When copying a file from the router to my laptop, top showed:

Mem: 383516K used, 130092K free, 20132K shrd, 23820K buff, 253576K cached
CPU:   0% usr   0% sys   0% nic  98% idle   0% io   0% irq   0% sirq
Load average: 0.12 0.09 0.03 1/128 7053
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
 5671  5665 root     S     783m 156%   0% /mnt/usb/syncthing -logfile=/tmp/sync
 7053  6864 root     R     1044   0%   0% top -d2
    3     2 root     SW       0   0%   0% [ksoftirqd/0]
 5665  5664 root     S     782m 156%   0% /mnt/usb/syncthing -logfile=/tmp/sync
 1705     1 root     S     3188   1%   0% /usr/sbin/collectd -f
 7052  7044 nobody   S     3160   1%   0% /usr/sbin/smbd -F
 7049  7044 root     S     2980   1%   0% /usr/sbin/smbd -F
 7045     1 root     S     2660   1%   0% /usr/sbin/nmbd -F
 7044     1 root     S     2588   1%   0% /usr/sbin/smbd -F
...

There seems little irq and sirq.

maybe worth trying with syncthing not running

I'm very confused by CPU usage being basically zero.

Can you test over Ethernet?

Thank you. The transfer speed reached 50MB/s when connected via Ethernet. Why the poor performance on wireless?

Mem: 488404K used, 25204K free, 20376K shrd, 36040K buff, 350748K cached
CPU:   1% usr   4% sys   0% nic  84% idle   0% io   0% irq   8% sirq
Load average: 0.05 0.01 0.00 4/128 7735
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
 7725  7044 nobody   R     3160   1%   7% /usr/sbin/smbd -F
  260     2 root     SW       0   0%   1% [kswapd0]
 2314     1 root     S     1616   0%   0% /usr/sbin/hostapd -s -P /var/run/wifi
 5671  5665 root     S     783m 156%   0% /mnt/usb/syncthing -logfile=/tmp/sync
 7735  7727 root     R     1044   0%   0% top
    3     2 root     SW       0   0%   0% [ksoftirqd/0]
 7702     2 root     SW       0   0%   0% [kworker/0:1]
 5665  5664 root     S     782m 156%   0% /mnt/usb/syncthing -logfile=/tmp/sync
 7534     1 root     S     3192   1%   0% /usr/sbin/collectd -f

Hi, I have never been anywhere near 50MB, which is amazing speed, I have only wr1043nd, but what helped me a lot was removing sync from options in /etc/config/fstab. Look for options rw,sync and try delete sync word, reboot and try speed again. Maybe wifi shares the same "wire" (interface, line, whatever) with USB interface on your router and that is why you have much lower speed via wifi.

1 Like

Is WiFi speed bad on both 5 and 2.4ghz?

I'm kinda thinking @nozombian might be right. Or at least it's not samba.

@jow Do you know anything about the way the hardware is setup? Or who to poke on the forum who knows more about Armada?

The speed of samba is slow on both 2.4G and 5G wireless (less than 1MB/s on 2.4G). But the speed of NFS can reach 30MB/s on 5G.

@nozombian My hard disk is attached to the E-SATA port instead of the USB 3.0. The SATA channel is built in to Armada 385. And the wireless chips are connected via PCI-E. I don't think they use the same "lane".

did you try disabling syncthing as fuller suggested a few posts earlier?
from the VSZ / %VSZ it uses more than 100% of available memory.

Yes. But I noticed no improvements in samba's throughput.

Hi weedy,
I have the same problem, maybe the samba version 3.6 is not high enough.
Anyway, what's "speed.txt" and the "manual pages" you referred?
And these settings should be put in /etc/samba/smb.conf ?
Thanks

While Samba 3.6 isn't ideal it certainly does perform better than ~3Mbyte/s. What clients are you using? Are you all also testing wired connections? There's some work getting Samba 4 in but it's in progress and rather hackish.