From owner-freebsd-fs@FreeBSD.ORG Tue Aug 30 23:03:13 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2E111065672; Tue, 30 Aug 2011 23:03:13 +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 9AEA18FC0A; Tue, 30 Aug 2011 23:03:13 +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 p7UMe7il013870; Tue, 30 Aug 2011 17:40:07 -0500 (CDT) Date: Tue, 30 Aug 2011 17:40:07 -0500 (CDT) From: Bob Friesenhahn X-X-Sender: bfriesen@freddy.simplesystems.org To: Lev Serebryakov In-Reply-To: <1693072185.20110831022933@serebryakov.spb.ru> Message-ID: References: <317753422.20110830231815@serebryakov.spb.ru> <201108302009.p7UK9CBQ085481@chez.mckusick.com> <103666698.20110831021404@serebryakov.spb.ru> <1693072185.20110831022933@serebryakov.spb.ru> 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]); Tue, 30 Aug 2011 17:40:07 -0500 (CDT) Cc: freebsd-fs@freebsd.org Subject: Re: Very inconsistent (read) speed on UFS2 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: Tue, 30 Aug 2011 23:03:13 -0000 On Wed, 31 Aug 2011, Lev Serebryakov wrote: > >> I'll try this experiment with mmap() and touching every 4096-th byte of >> mapped memory instead of read(2). > Strange enough, it gives only 40-50MiB/s and results are very > consistent. > > It really surprise me. I didn't think, that there will be so much > difference, I was sure, that it will be almost equivalent speed. FreeBSD does not seem to default to sequential read-ahead when memory mapping is used with sequential page access. Try using madvise() with the MADV_SEQUENTIAL option and see if it helps. There are also MADV_WILLNEED, MADV_DONTNEED, and MADV_FREE. Careful use of these options can help performance quite a lot when data is large compared to memory. Bob -- Bob Friesenhahn bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/