From owner-freebsd-fs@FreeBSD.ORG Wed Jan 11 15:42:09 2012 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 276B9106566B for ; Wed, 11 Jan 2012 15:42:09 +0000 (UTC) (envelope-from bfriesen@simple.dallas.tx.us) Received: from blade.simplesystems.org (blade.simplesystems.org [65.66.246.74]) by mx1.freebsd.org (Postfix) with ESMTP id DD7A88FC12 for ; Wed, 11 Jan 2012 15:42:08 +0000 (UTC) Received: from freddy.simplesystems.org (freddy.simplesystems.org [65.66.246.65]) by blade.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id q0BFftOq025961; Wed, 11 Jan 2012 09:41:55 -0600 (CST) Date: Wed, 11 Jan 2012 09:41:55 -0600 (CST) From: Bob Friesenhahn X-X-Sender: bfriesen@freddy.simplesystems.org To: "Mikhail T." In-Reply-To: <4F0D268B.9060908@aldan.algebra.com> Message-ID: References: <4F0CBB79.7010704@aldan.algebra.com> <4F0D268B.9060908@aldan.algebra.com> User-Agent: Alpine 2.01 (GSO 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (blade.simplesystems.org [65.66.246.90]); Wed, 11 Jan 2012 09:41:55 -0600 (CST) Cc: fs@freebsd.org Subject: Re: How to best send files over network? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 15:42:09 -0000 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/