Samba performance hit on large reads, advice wanted.

David Collier-Brown -- Customer Engineering David.Collier-Brown at Sun.COM
Tue May 6 11:58:11 GMT 2003


   I'm working on a patch to deal with a performance problem,
and need a few words of advice...

    A customer has a Sun V880, running the new QFS filesystem,
and connected to STK D178 Fibre Channel Storage Arrays.
    The server provides Windows (streaming) Media files, served
up to NT machines running Windows Media Server, and the throughput
is quite poor: they're only seeing 10 MB/S and the filesystem can,
at the very least, deliver 100 MB/S.
    An engineer from the QFS team, Rick Matthews, ran truss on the
samba server, and is seeing a stream of small read requests going
to Solaris.  A script on the same machine doing large requests gets
the expected high throughput.

    I did a test with dbench, and found that QFS is indeed about
10 times faster than ufs on the same machine, assuming reasonably
large reads.

    I therefor did a hack to use the write cache as a read cache
for both 2.2 and 3.0.  However, the criteria for refilling the
cache is "cache is empty".
    Assuming an 8K cache and a series of reads that aren't exact
divisors of 8k, at some point one of the reads from the cache
is going to come back with less than a full buffer.  The next read
will find the cache has been emptied, refill it and return the
expected amount.
    This looks sane in the following functions, where the
returned lengths are only checked to see if they are negative:
File       Function           Line
blocking.c process_lockread    333
reply.c    reply_read         1684
reply.c    reply_lockread     1635
reply.c    send_file_readX    1774
reply.c    reply_readbmpx     4067
   The question in my mind, however, is what will windows clients
when they try to read N bytes and get N-3?  Some Unix programs
will think that's end of file: will Windows programs think that?

   And there is one very odd call to read_file, from
File       Function           Line
reply.c    send_file_readbraw 1451
   In send_file_readbraw the return value is checked to see if
it's below mincount, and if it is the data appears to be discarded
and not written to the client!
   Send_file_readbraw is called from reply_readbraw, where
mincount is computed from (SVAL(inbuf,smb_vwv4) & 0xFFFF)
   Can anyone tell me if this function will actually discard
data? Or if it should (;-))

--dave
-- 
David Collier-Brown,           | Always do right. This will gratify
Sun Microsystems DCMO          | some people and astonish the rest.
Toronto, Ontario               |
(905) 415-2849 or x52849       | davecb at canada.sun.com




More information about the samba-technical mailing list