[Samba] libsmbclient: poor performance using SMB2/3

Bell D. D.Bell at soton.ac.uk
Sun Jun 11 16:23:59 UTC 2017


Hello,

I use libsmbclient from Python, using pysmbc: https://pypi.python.org/pypi/pysmbc (its a very thin wrapper around libsmbclient).

When setting "client max protocol" in smb.conf to SMB2 (or higher), libsmbclient then switches to SMB2 if the server supports it. Performance of opendir() remains much the same, but calling stat() is about 40 times slower when using SMB2.

Time taken to open a directory in a share and stat all the files within it: 

SMB2/3: ~14 seconds
SMB1: ~0.34 seconds

Here is a comparison when using libsmbclient through pysmbc in a web application (bargate.io):

SMB1: https://evad.io/img/smb1.png
SMB2/3: https://evad.io/img/smb2.png

Is this expected behaviour? Is libsmbclient not meant to be used with SMB2/3? Is there a better way to determine file size and things like modification time rather than call stat() ? Should smbcli be used rather than libsmbclient?

I've tested this on various versions of Samba/libsmbclient, including 4.6, and it remains the same.
 
Cheers, 
  
David Bell
Senior Specialist
University of Southampton


More information about the samba mailing list