From owner-freebsd-stable@FreeBSD.ORG Wed May 29 14:26:25 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 73499235; Wed, 29 May 2013 14:26:25 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost1.sentex.ca (smarthost1-6.sentex.ca [IPv6:2607:f3e0:0:1::12]) by mx1.freebsd.org (Postfix) with ESMTP id 320637F1; Wed, 29 May 2013 14:26:25 +0000 (UTC) Received: from [192.168.43.26] (pyroxene.sentex.ca [199.212.134.18]) by smarthost1.sentex.ca (8.14.5/8.14.5) with ESMTP id r4TEQOE1001319; Wed, 29 May 2013 10:26:25 -0400 (EDT) (envelope-from mike@sentex.net) Message-ID: <51A61035.9050900@sentex.net> Date: Wed, 29 May 2013 10:27:01 -0400 From: Mike Tancsa Organization: Sentex Communications User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Scott Long Subject: vfs.read_min (was Re: svn commit: r250906 - stable/9/sys/kern) References: <201305220844.r4M8iLWJ005148@svn.freebsd.org> In-Reply-To: <201305220844.r4M8iLWJ005148@svn.freebsd.org> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.72 on 64.7.153.18 Cc: FreeBSD-STABLE Mailing List X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2013 14:26:25 -0000 Hi Scott, This seems to significantly help for reading through large files (argus / netflow files in my case) on my zfs server. Doing some quick tests and setting the size to 2 makes a difference from the default. In your case, did you find some optimal settings ? Are there some tradeoffs / caveats to setting this value to a non default value ? ---Mike On 5/22/2013 4:44 AM, Scott Long wrote: > Author: scottl > Date: Wed May 22 08:44:21 2013 > New Revision: 250906 > URL: http://svnweb.freebsd.org/changeset/base/250906 > > Log: > MFC r250327 > > Add a sysctl vfs.read_min to complement the exiting vfs.read_max. It > defaults to 1, meaning that it's off. > > When read-ahead is enabled on a file, the vfs cluster code deliberately > breaks a read into 2 I/O transactions; one to satisfy the actual read, > and one to perform read-ahead. This makes sense in low-latency > circumstances, but often produces unbalanced i/o transactions that > penalize disks. By setting vfs.read_min, we can tell the algorithm to > fetch a larger transaction that what we asked for, achieving the same > effect as the read-ahead but without the doubled, unbalanced transaction > and the slightly lower latency. This significantly helps our workloads > with video streaming. > > Submitted by: emax > Reviewed by: kib > Obtained from: Netflix > > Modified: > stable/9/sys/kern/vfs_cluster.c > Directory Properties: > stable/9/sys/ (props changed) > > Modified: stable/9/sys/kern/vfs_cluster.c > ============================================================================== > --- stable/9/sys/kern/vfs_cluster.c Wed May 22 07:52:41 2013 (r250905) > +++ stable/9/sys/kern/vfs_cluster.c Wed May 22 08:44:21 2013 (r250906) > @@ -75,6 +75,10 @@ static int read_max = 64; > SYSCTL_INT(_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0, > "Cluster read-ahead max block count"); > > +static int read_min = 1; > +SYSCTL_INT(_vfs, OID_AUTO, read_min, CTLFLAG_RW, &read_min, 0, > + "Cluster read min block count"); > + > /* Page expended to mark partially backed buffers */ > extern vm_page_t bogus_page; > > @@ -169,6 +173,7 @@ cluster_read(vp, filesize, lblkno, size, > } else { > off_t firstread = bp->b_offset; > int nblks; > + long minread; > > KASSERT(bp->b_offset != NOOFFSET, > ("cluster_read: no buffer offset")); > @@ -176,6 +181,13 @@ cluster_read(vp, filesize, lblkno, size, > ncontig = 0; > > /* > + * Adjust totread if needed > + */ > + minread = read_min * size; > + if (minread > totread) > + totread = minread; > + > + /* > * Compute the total number of blocks that we should read > * synchronously. > */ > _______________________________________________ > svn-src-stable-9@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 > To unsubscribe, send any mail to "svn-src-stable-9-unsubscribe@freebsd.org" > > -- ------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada http://www.tancsa.com/