Samba writing speed with big blocks

David Collier-Brown davecb at
Mon Dec 13 13:37:03 GMT 1999

Petr Sulla <xsulla at> 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:

	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
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

  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

  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

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

More information about the samba mailing list