Re: [Samba] Linux vs. Windows SMB buffering
- Date: Mon, 9 Oct 2017 14:23:40 -0700
- From: Jeremy Allison via samba <samba@xxxxxxxxxxxxxxx>
- Subject: Re: [Samba] Linux vs. Windows SMB buffering
On Mon, Oct 09, 2017 at 08:29:43PM +0000, Will Lucas wrote:
> > 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.
> 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
> 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:
> printcap name=cups
> winbind enum groups=yes
> min protocol=NT1
> socket options=TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
> local master=no
> use sendfile=yes
> min receivefile size=16384
> passdb backend=smbpasswd
> write cache size=2097152
> smb2 leases=yes
> max protocol=SMB3
> winbind enum users=yes
> getwd cache=true
> load printers=yes
> 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://
> Hopefully, I'm getting closer? :) Does the smb.conf looks reasonable to you?
So it's now getting a RWH lease, but still doing the raw
syscall reads across the wire.
Does it do the same to a Windows server ? Looks like the
client application is deliberately turning off any
redirector caching by using FILE_FLAG_WRITE_THROUGH on
the CreateFile() Win32 call. If you can do the equivalent
of strace on Windows (I don't know how) you might be
able to confirm that and ask the app developer to stop
Write operations will not go through any intermediate cache, they will go directly to disk.
For additional information, see the Caching Behavior section of this topic.
To unsubscribe from this list go to the following URL and read the