How to best send files over network?

Bob Friesenhahn bfriesen at simple.dallas.tx.us
Wed Jan 11 18:29:25 UTC 2012


On Wed, 11 Jan 2012, Rick Macklem wrote:
>> disgusting in the age of better interfaces (even if those aren't well
>> implemented yet) :-)
>
> I think Bob was referring to the receive end and not the send end, which
> might be why the answer didn't make sense to you? (For the receive end,
> it sounds like a good suggestion to me.)

Yes, I am definitely talking about the receive (or the writing end).

The main advantage of using sendfile() seems to be to keep the file 
data from needing to transit a user-space program.  This is a noble 
goal but circumstances have changed (i.e. bottlenecks have moved) 
since sendfile() was invented.  If FreeBSD sendfile is using memory 
mapping in its implementation, then that is definitely bad for zfs.

Besides the double-buffering, double-memcpy, and additional code 
context switching, added by mmap on top of zfs, there is also the 
issue that zfs block sizes are usually 128K whereas MMU pages are 
usually only 4K.  If the kernel does its write I/O requests in units 
of 4K that is not ideal for zfs (but zfs can deal with it), but it is 
particularly bad if the file is accessed via NFS.

> Well, I think you can strcmp("zfs", sb.fs_fstypename) == 0 to check for
> a zfs file system. However, if the file system type name gets changed
> to something like zfsv32 (just a hypothetical example), the above breaks.
> (There is a case of this in the NFS server code, so hopefully it won't
> break for a while.;-)

I did not see that member mentioned in the manual page.  Apparently it 
does exist anyway.

Bob
-- 
Bob Friesenhahn
bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


More information about the freebsd-fs mailing list