1

I am trying to calculate required IOPS for a fileserver, and to do this I need to know the typical block size. I know that NFS clients can use rsize and wsize to specify how much data is sent over the network. Does the NFS server also use these same values to write the data to the disk, or is there some other way to configure that? I haven't found anything in the man pages.

Elliott B
  • 565

1 Answers1

0

AIUI, it might use the same sizes if you switch the NFS export to sync mode. Otherwise, the comment by 炸鱼薯条德里克 is correct. It works like the underlying Linux filesystem, except that close() implies fsync().

http://nfs.sourceforge.net/nfs-howto/ar01s05.html#sync_versus_async

So how does the underlying Linux filesystem work?

The writes go into the kernel page cache. This is a writeback cache. Because of this, multiple contiguous write requests can be merged into one.

The average size of writes the kernel sends to the disk device can be seen using the iostat command (i.e. on your NFS server).

sourcejedi
  • 50,249
  • I think this depends on the application. For example here it says that GNU cp uses 128K blocks, while on my CentOS system it uses 64K as shown in strace. https://eklitzke.org/efficient-file-copying-on-linux – Elliott B Sep 20 '19 at 21:47
  • Okay. Then how do you control the block size going from cache to disk? – Elliott B Sep 20 '19 at 22:28
  • @ElliottB So, obviously it's split on hardware limitations. You can also set a soft limit on requests in general, I guess this is mostly to limit induced latency. /sys/class/block/$DEVICE/queue/max_sectors_kb, except see https://unix.stackexchange.com/questions/529529/why-is-the-size-of-my-io-requests-being-limited-to-about-512k. If there isn't any competing uncached/sync IO, I don't see that it would make a lot of difference, it would just make multiple requests in a row. IIRC it cycles between files with cached writes, and the amount written per file is some hard-coded value (16M?). – sourcejedi Sep 20 '19 at 22:40
  • "depends on the application" - no - the size of a single IO operation is fixed. The size of operations at different levels in the stack is variable. – symcbean Sep 07 '23 at 13:10