[jcifs] Large Read/Write Patch

Michael B Allen ioplex at gmail.com
Fri Jul 22 12:02:51 MDT 2011


On Mon, Jul 18, 2011 at 5:37 AM, polivenok <polivenok at yandex.ru> wrote:
> Hi Guys,
>
> We have noticed that on Windows 7 we expirence low trasfer rate for
> read/write operations and using wireshark we found that the reason was in
> buffer size. jcifs used 4K buffer even when we set snd/rcv buffer sizes and
> windows client used 64K. The reason of low 4K buffer was that it is default
> value for MaxBufferSize on windows samba server.
>
> For normal SMB_COM_READ and SMB_COM_WRITE requests, the maximum buffer size
> is always equal to MaxBufferSize. But if CAP_LARGE_READX  or
> CAP_LARGE_WRITEX  capability is enabled on the SMB Negotiate Server
> Response,he maximum buffer size  used  is  61440 (60K)  for large read(
> SMB_COM_ READ_ANDX )  and 65535 (64K) for large write (SMB_COM_WRITE_ANDX) ,
> regardless of MaxBufferSize.
>
> More info can be found here:
>
> http://blogs.msdn.com/b/openspecification/archive/2009/04/10/smb-maximum-transmit-buffer-size-and-performance-tuning.aspx
>
> With old LargeReadWrite.patch we had an issue with checking large/read write
> capability on linux samba server 3.5.4 so code for this check was modified a
> bit.
>
> Below you can find some result for smb server with enabled large read/write:
> jcifs-1.3.16                    ~2.5 M/s
> jcifs-1.3.16 with patch    ~9M/s
> Native client read/write   ~9.5M/s
> Modified patch for 1.3.16 is attached.

Hi Dmytro,

I have placed your patch into the patches directory for others to use
and I have also added it to the TODO list for further consideration.
Unfortunately I do not have a lot of "Free" time these days (and I
just did a significant release) so I do not expect to get around to
this for a while. But when I do get around to adding this
functionality your patch should be very helpful. Thanks.

For those who may want to apply it, note that I have not really looked
at this patch closely other than to see that it does not do anything
obviously wrong. And note that the effects of buffer sizes on
performance can very greatly. Meaning it is possible that using a
larger buffer size results in throughput actually decreasing. This
might seem strange and although it is unlikely, I have seen it first
hand.

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jCIFS mailing list