[Samba] Linux vs. Windows SMB buffering
Jeremy Allison
jra at samba.org
Fri Oct 6 18:25:28 UTC 2017
On Fri, Oct 06, 2017 at 06:09:32PM +0000, Will Lucas via samba wrote:
> Hi all,
>
> In our office we use a program that makes many small writes to a file. We
> have been trying to use this program with our NAS, which hosts a Samba
> share on the network. However, the performance of the program is
> staggeringly slow on Window 7, 8.1, and 10.
>
> To make the problem easily repeatable, I created a small C++ program to
> just write 1 million lines to a file:
> https://github.com/mevatron/nas-write-test
>
> 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 was hoping someone with more knowledge of SMB has seen this before or has
> deeper insights into what I can do to solve it.
>
> I have a more visual write up of all of this on ServerFault here:
> https://serverfault.com/questions/808633/small-writes-to-smb-network-share-are-slow-on-windows-fast-over-cifs-linux-moun
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.
More information about the samba
mailing list