[Samba] Linux vs. Windows SMB buffering

Will Lucas mevatron at gmail.com
Mon Oct 9 20:29:43 UTC 2017


> The Linux client is asking for SMB1 and using 1MB write sizes.
>
> The Windows client is using SMB2 and *NOT ASKING FOR LEASES*.
>
> This is why the performance is terrible. Because the file
> as no lease, the Windows redirector must pass every single
> WriteFile() system call onto the wire, no matter how small
> the size.
>
> If you can get the Windows SMB2 client to request a lease,
> the performance problem will be solved.

Jeremy,

Thanks for the response that's definitely more information than I've been
able to find over the past year!

> What is your server ? Is it Samba ? If so what version ?

My NAS is a Synology DS215j and it is running Samba. smbd -V gives me the
following:
Version 4.4.13
Synology Build 15152, Jul 13 2017 04:48:37

So, this morning I ran a test by enabling leases, which were not enabled on
the server before. So, now my smb.conf looks like this:
[global]
printcap name=cups
winbind enum groups=yes
include=/var/tmp/nginx/smb.netbios.aliases.conf
min protocol=NT1
socket options=TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
security=user
local master=no
realm=*
use sendfile=yes
min receivefile size=16384
passdb backend=smbpasswd
write cache size=2097152
smb2 leases=yes
printing=cups
max protocol=SMB3
winbind enum users=yes
getwd cache=true
load printers=yes
workgroup=WORKGROUP

I noticed now that the packet capture shows Negotiate Protocol Response
conversations between the server and the Windows client. It also seems the
client is now using a lease.  Unfortunately, the Windows client is still
immediately writing one line at a time :(

I have uploaded the new packet capture snippet here (2MB):
https://drive.google.com/open?id=0B6UHr3GQEkQwcXdEWVRFSXRMNnc

Hopefully, I'm getting closer? :) Does the smb.conf looks reasonable to you?

Thanks again for all your help, it's greatly appreciated!
Will

On Fri, Oct 6, 2017 at 7:09 PM Jeremy Allison <jra at samba.org> wrote:

> On Fri, Oct 06, 2017 at 07:26:29PM +0000, Will Lucas wrote:
> >
> >     Does the wireshark trace show the Windows client asking for and
> >     getting a RWH lease under SMB2 ? If so, then there's no reason
> >     it can't be caching the entire file locally. Seems strange
> >     behaviour from the Windows redirector here.
> >
> >
> > I have uploaded the Linux packet capture here (14MB):
> https://drive.google.com/
> > open?id=0B6UHr3GQEkQwWXJ1NjVwMkJXOEU
> >
> > Also, here is the corresponding Windows packet capture as well
> (375MB): https:/
> > /drive.google.com/open?id=0B6UHr3GQEkQwbFhOY0lCcEFjZkU
> > to Windows :-).
>
> The Linux client is asking for SMB1 and using 1MB write sizes.
>
> The Windows client is using SMB2 and *NOT ASKING FOR LEASES*.
>
> This is why the performance is terrible. Because the file
> as no lease, the Windows redirector must pass every single
> WriteFile() system call onto the wire, no matter how small
> the size.
>
> If you can get the Windows SMB2 client to request a lease,
> the performance problem will be solved.
>
> What is your server ? Is it Samba ? If so what version ?
>


More information about the samba mailing list