[Samba] Linux vs Windows SMB performance

Michael Tokarev mjt at tls.msk.ru
Mon Jul 10 10:24:54 UTC 2023


07.07.2023 20:50, Jerome Tournier via samba wrote:
> Hello,
> 
> I'm facing a performance issue I can't resolve.
> I have a Samba server (4.15.13) acting as a file share to both Linux
> (CentOS 7 mainly) and Windows 10 clients.
> 
>  From Linux client, I run a python script that will parse recursively one
> directory of the share (os.scandir) and display the time needed to scan the
> directory => 3s.
>  From Windows client, the same script run in 11s.
> 
> I use the same python version (2.7) on both Linux and Windows.
> I don't have any anti-virus, realtime software, ... that could impact
> performances.
> 
> On Windows, if I make a NFS mount point, the script take 3s to run. Python
> interpreter is then not in cause.
> 
> I try dozens of samba options (forcing SMB client version, ...) and
> stopping all unneeded services on Windows and I was never able to go faster
> than 11s.
> 
> Using Wireshark, I can see that almost all the time is used for SMB2
> protocol (for Create, Find and GetInfo procedure).
> 
> May someone have any idea ?

No ideas really, except that when I have to copy a large amount of files
from/to a windows machine, I usually archive them on the machine they're
on (creating a .zip archive, usually with no compression), and extract
files from that archive on the destination machine.  This way, network is
used only to open-read-close a single file (the archive itself), and the
whole operation (even including the archive in the first place) is fast.

For example, I had to move a user directory (with ~100000 files in it)
from one windows machine to another.  Direct copy estimated 21 hours.
After creating archive on the source machine (which took about 20 min),
its extraction on the target machine over network took another ~20 min.
Once again: this is between two windows machines, no samba is involved.
It doesn't matter if I copy from local to remote or from remote to local -
it is insanely slow.

The same thing happens when copying large amount of files from a samba
server to a windows machine: it is dramatically faster to archive files
on server and extract them from one archive file on windows.

It hasn't been this way on windowsXP for sure, but it is this way on
current win10.  Turning off antivirus on windows helps but just a little
bit, not significantly.

FWIW.

/mjt



More information about the samba mailing list