Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2012 01:04:59 -0500
From:      "Mikhail T." <mi+thun@aldan.algebra.com>
To:        Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Cc:        fs@freebsd.org
Subject:   Re: How to best send files over network?
Message-ID:  <4F0D268B.9060908@aldan.algebra.com>
In-Reply-To: <alpine.GSO.2.01.1201101741080.20764@freddy.simplesystems.org>
References:  <4F0CBB79.7010704@aldan.algebra.com> <alpine.GSO.2.01.1201101741080.20764@freddy.simplesystems.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10.01.2012 18:49, Bob Friesenhahn wrote:
> Don't use mmap on zfs since doing so wastes memory (zfs ARC is not 
> coherent with mmap page cache).  Instead do normal file I/O (e.g. 
> write, fwrite) using the filesystem blocksize (e.g. 128K) or a small 
> multiple thereof.
Well, that was the reason cited for not using sendfile over ZFS. But 
mmap/write, it was claimed, was efficient.

What's the general opinion of using mmap/write, when the file is on UFS? 
Is it just as good as sendfile, or can sendfile be better under some 
circumstances?

> It is useful to cache several blocks on the receiving end and use a 
> thread to receive data from the network in case zfs temporarily stalls 
> during write (which it periodically does).
No, thanks. I'm certainly not doing a read/write loop -- that's just too 
disgusting in the age of better interfaces (even if those aren't well 
implemented yet) :-)
>
>> If, indeed, sendfile is best for UFS, but mmap/write is better over 
>> ZFS, what is the best way to determine the underlying FS for each 
>> file? statfs(2) is supposed to answer that question -- what should I 
>> look for in the struct statfs, that it will return? Do I check, if 
>> f_fsid contains a magic number for ZFS, or look for a magic string in 
>> f_fstypename? Could someone provide an example?
>
> Use it to obtain the filesystem block size. 
Ok, but still -- how does one determine the filesystem, where a 
particular file resides? Thanks!

    -mi




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F0D268B.9060908>