NFS Performance

Steven Johnson sjohnson at sakuraindustries.com
Wed Sep 13 11:09:23 UTC 2006


Till Straumann wrote:

> Steven Johnson wrote:
>
>> Well we tried this and defining HAVE_BLKSIZE did not break our program.
>>
>> BUT the st_blksize is set to 4096 bytes, and we know that max
>> performance seems to be when it is 8K.  The problem is we can't find
>> where the 4K for st_bufsize is being set.  Its being copied by nfs from
>> an fattr structure (line 2838 in nfs.c, right under a suspicious TODO
>> comment), but where the fattr structure gets the 4k from is currently a
>> mystery. 
>
> It's the block size of the file on the server [I had looked at linux -
> there is
> no way to tune this for the linux NFS server]

OK, well that solves that mystery.

>>  We could just hack NFS to not copy it from the fattr structure
>> and force it to 8K, but this doesn't seem the right thing to do.
>>   
>
> Why not? That's just what I would do - supposedly,

Well, it just seemed the better thing to do would be to handle it where
fattr was set, but if it is coming from the NFS server, that would be a
very deceiving thing to do, and doing it here would certainly be best.

>
>  "The value st_blksize gives the "preferred" blocksize for efficient
> file system I/O."
>
> I'd make it a run-time tunable feature by means of a global flag.

Sound's fine.  Changing it there is quite easy.  I think it should
default to 8K, and let the user tune it down by way of a sysctl.  Ill
have the code added and tested, if it turns out OK, (which i suspect it
will) I will post the patch.

>
> Comments?

Sounds like a plan.  I'll let you know how we get on.

Steven Johnson

>
> -- T.
>
>> Steven Johnson
>>
>> Till Straumann wrote:
>>
>>  
>>
>>> Here's something (regarding default block size used by newlib/stdio) I
>>> found out:
>>>
>>> If newlib was compiled with HAVE_BLKSIZE defined then it would use
>>> the st_blksize information [newlib makebuf.c does a 'stat' anyways]
>>> when
>>> configuring the default buffer for stdio.
>>>
>>> Some filesystems (msdos, nfs) do set st_blksize, others (imfs) do not
>>> but since libcsupport/src/stat.c does zero-out the stat buf argument
>>> [and newlib uses BUFSIZ for st_bufsz <= 0] I believe defining
>>> HAVE_BLKSIZE should be OK.
>>>
>>> We could use this trick to let rtems NFS transparently increase the
>>> buffer size for
>>> stdio to 8k (nfs v2 limit).
>>>
>>> -- Till
>>>
>>> Steven Johnson wrote:
>>>
[snip]



More information about the users mailing list