[Samba] 32 seconds vs 72 minutes -- expected performance difference?

Aurélien Aptel aaptel at suse.com
Mon Feb 11 09:35:11 UTC 2019

Saurabh Nanda via samba <samba at lists.samba.org> writes:
> I am sharing a 120GB folder with lots of files via Samba on a LAN (1Gbps
> connection).
> 1) Doing an `ls -lR` on the server (on this folder) takes ~32 seconds,
> compared with **72 minutes** on the client. Is this difference in
> performance expected (due to network and protocol overhead)?

Unless you upload a network capture of you mounting and doing the ls -lR
on the client it's hard to say what really goes on. I understand you
might not want to make it public.. but if you do

You can make a capture using:

tcpdump -s 0 -w capture.pcap port 445 &
mount.cifs //foo/bar /mnt -o ....
ls -lR /mnt
#..wait or kill ls..

kill $tracepid

Note that you can probably kill tcpdump after 10mn or so. This should
provide enough data. If you end up doing it, the capture will probably
be quite large, try compressing it as well. 

> 2) While the client is executing an `ls -lR`, one smbd process on the
> server uses about 30-40% of a single CPU (on an 4c/8t machine). Is this
> much CPU load expected? (Also, the client ends up consuming all 1Gbps of
> network bandwidth).
> Is samba transferring all the files from the server to the client for this
> operation?

No it shouldn't.

> Server & client, both, are on Ubuntu 18.04 and are using the stock version
> of the kernel, samba, etc. The version being reported:

How are you mounting your share (which mount options)?

I can't comment on the server side but using a very recent kernel
version like 4.20 or above (which at the moment is 5.0-rc6 :/) you will
get compounding, which basically bundles multiple SMB operations in one
paquet and saves a lot of round trips as a result. Note that compounding
requires mounting using SMB2+ user vers= mount option, cf mount.cifs man

I suspect it won't solve the problem but it's something.

Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

More information about the samba mailing list