Samba writing speed with big blocks

David Collier-Brown davecb at canada.sun.com
Mon Dec 13 13:37:03 GMT 1999


Petr Sulla <xsulla at informatics.muni.cz> wrote:
> I'm having serious problems with Samba's writing speed (both 2.0.5a from
> RH 6.1 and 2.0.6 compiled from sources) on a 100Mbit network.
> 
> If I write a file with block size 65487 or less, then the writing speed 
> is about 7-8 MB/s - a very nice value, my bow to the Samba team :)
> 
> If I change the block size to 65488 or more, then the writing speed falls
> down to 3 MB/s, which is not what I expect from a 100Mbit network :\
> 
> Samba behaves this way even if SO_RCVBUF and SO_SNDBUF are set to 8192
> and "read size" to 16384 and "max xmit" to 16384.


> 
> The corresponding part of my smb.conf looks like this:
>    socket options = TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT SO_KEEPALIVE SO_RCVBUF=65535 SO_SNDBUF=65535

	A quibble: IPTOS_LOWDELAY IPTOS_THROUGHPUT are opposites,
	so only one will be used. I recommend IPTOS_LOWDELAY,  but
	don't expect this to have any measurable effect in your case...

>    read size = 65535
>    max xmit = 65535


> This problem is perhaps not very interesting if you only use Explorer or
> WinCommander, because they both use block size smaller than 65488. But we
> use a special program with greater blocksize... :\

	Ok, something's out of whack.... let's go through the
	parameters first, then the testing procedure you'll need
	to apply.
	
1) max xmit is a parameter that is used to negotiate 
the size of the largest smb transfer unit. The code says:

/*
 * Size of data we can send to client. Set
 *  by the client for all protocols above CORE.
 *  Set by us for CORE protocol.
 */
int max_send = BUFFER_SIZE;
/*
 * Size of the data we can receive. Set by us.
 * Can be modified by the max xmit parameter.
 */
int max_recv = BUFFER_SIZE;

  If the client is requesting large buffers, Samba
will try to honor the request, and max xmit won't
help much. If you set your debug level greater than 6,
you should see a line "Client requested max send size of xxx"
in the log.

	
2) read size is a "buffering option for servers with mismatched disk
and
network speeds". The code says:

if (size == 0) {
    size = lp_readsize();
    size = MAX(size,1024);
}

  So it will be set to 1024 or less in transfer_file() and
do_read_prediction()... and the code doesn't seem to agree with the
documentation, it really looks like some kind of buffer size.[Samba
team: did this not used to be MIN(xxx,1024) ???]

3) SO_RCVBUF and SO_SNDBUF are the window sizes used by TCP: the
number of bytes to read/write before demanding an ACK from the other
end.

  All of these will need to be tuned independently, as we don't
know a priori which is going to address the problem.

  I suggest a set of trivial benchmarks, starting with a test
with ftp, to see if it's TCP or Samba proper, then 
setting all the options back to the defaults, then varying
one at a time and ploting a little graph for each, which should
look like
http://www.oreilly.com/catalog/samba/chapter/book/appb_02.html#appb-34738

  Feel free to seemed me raw data in email: I'm curious why you're
seeing this effect, and I'd like to see it running faster.

  And one last thing: after one run at debug level = 6 or more, set it
back to 1 or 0: the higher levels of logging slow the program
significantly!

--dave 
--
David Collier-Brown,  | Always do right. This will gratify some people
185 Ellerslie Ave.,   | and astonish the rest.        -- Mark Twain
Willowdale, Ontario   | //www.oreilly.com/catalog/samba/author.html
Work: (905) 415-2849 Home: (416) 223-8968 Email: davecb at canada.sun.com


More information about the samba mailing list