Date: Wed, 11 Jan 2012 09:41:55 -0600 (CST) From: Bob Friesenhahn <bfriesen@simple.dallas.tx.us> To: "Mikhail T." <mi+thun@aldan.algebra.com> Cc: fs@freebsd.org Subject: Re: How to best send files over network? Message-ID: <alpine.GSO.2.01.1201110931340.15666@freddy.simplesystems.org> In-Reply-To: <4F0D268B.9060908@aldan.algebra.com> References: <4F0CBB79.7010704@aldan.algebra.com> <alpine.GSO.2.01.1201101741080.20764@freddy.simplesystems.org> <4F0D268B.9060908@aldan.algebra.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 11 Jan 2012, Mikhail T. wrote: > 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. You don't usually want to write files using mmap because it is hard to do so properly and because some operating systems are not very good about writing the dirty pages when they should. You should avoid using mmap on zfs in general because it will double the memory consumption and double the buffer copies. > 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) :-) Yes, it seems antique but if you are looking for optimum performance that you can tune and have control over, this is the way to go. You could also try using async I/O. >> Use it to obtain the filesystem block size. > Ok, but still -- how does one determine the filesystem, where a particular > file resides? Thanks! I would tell you to use statvfs and the f_basetype member of the statvfs struct but it seems that FreeBSD only supports a very limited version of this structure. Regardless, if the filesystem is mounted via NFS or SMB then the system is likely to lie about the true underlying filesystem. Bob -- Bob Friesenhahn bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.GSO.2.01.1201110931340.15666>