[Samba] Linux vs. Windows SMB buffering

Jon Gerdes gerdesj at blueloop.net
Fri Oct 6 23:52:57 UTC 2017

On Fri, 2017-10-06 at 18:09 +0000, Will Lucas via samba wrote:
> Hi all,


> Next, I performed a packet capture of the two OS conversations with
> Wireshark. I found the Linux SMB implementation buffer many hundreds
> of
> lines into each write; whereas, Windows decides to immediately flush
> it's
> buffer to disk on each line write, which obviously causes tremendous
> protocol overhead and thus abysmal performance.
> I have tried adjusting Lanmanworkstation parameters:
> https://technet.microsoft.com/en-us/library/cc978438.aspx
> The ones that looked promising are shown below:
> MaxCollectionCount
> "Specifies the amount of data that must be present in the character-
> mode
> buffer of a named pipe to trigger a write operation. If the amount of
> data
> in the buffer meets or exceeds this value, it is written immediately.
> Otherwise, it is retained in the buffer until either more data is
> added or
> the value of the CollectionTime entry expires.
> Increasing the value of this entry can improve the performance of
> named-pipe applications, but it does not affect applications, such as
> Server applications, that do their own buffering."


I'm no expert here but how does say SQL Server indicate that it does
its own buffering?  I think you have managed to go as far as you can
with your approach and have hit a fundamental Windowism.  You clearly
know what you are doing and have spent quite a while on hitting a
brickwall, that needs (Windows) source code to get to the bottom of.

Might I suggest that you re-evaluate how your program works? Getting
"Seems strange behaviour from the Windows redirector here." from Mr A
does imply that it may not be easy to fix.

A first thought is, can you buffer reads at the client end before
sending them to the network?


More information about the samba mailing list