From owner-freebsd-stable@FreeBSD.ORG Fri Nov 29 12:01: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]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D589317A for ; Fri, 29 Nov 2013 12:01:25 +0000 (UTC) Received: from mail-pb0-x22a.google.com (mail-pb0-x22a.google.com [IPv6:2607:f8b0:400e:c01::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ACDE911A9 for ; Fri, 29 Nov 2013 12:01:25 +0000 (UTC) Received: by mail-pb0-f42.google.com with SMTP id uo5so14375750pbc.15 for ; Fri, 29 Nov 2013 04:01:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=S3oLkHGPuQR6TwNddjKvEmqdgc29kZUDlCrkHer5bNQ=; b=acDFdXl/HN8zmNK7Ak8g+Cj+uoDAnGo3DabUPSHFfLTcLNvQxtz/rj7jFQhZGPUW/F 3ovQPP0YMaIIp4V+TSxXlF1y9uIm4hig+McRKSZHyXHw3qr4q+UKND7mQIdzIeCqlr8P qdVkzzDahbbdAF5T9LkFRdcygDWGMjVOG56IMbE5tI8yfLfWfOvR0gTM8RkgLgeHD0LK /5E0M1jsijkg547lrWGSCvvZ28QJJXPd72ot7rvdtlbvvUoeP6bhkGGafCxMRh5NDJ6U iFAchfARFGXAvKQu9nM4R7qHf3ENlZnXnvWRS3wTQP1tvFccBsDWbvJypWDe6vOYjtNH gNDQ== MIME-Version: 1.0 X-Received: by 10.66.168.12 with SMTP id zs12mr13623859pab.122.1385726485083; Fri, 29 Nov 2013 04:01:25 -0800 (PST) Received: by 10.68.16.232 with HTTP; Fri, 29 Nov 2013 04:01:25 -0800 (PST) In-Reply-To: <20131128220305.e715adb95b16f494224052f5@fastmail.fm> References: <5297ABD5.5060504@gmail.com> <20131128220305.e715adb95b16f494224052f5@fastmail.fm> Date: Fri, 29 Nov 2013 07:01:25 -0500 Message-ID: Subject: Re: gmirror: writes are faster than reads From: "illoai@gmail.com" To: Schaich Alonso Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: ml-freebsd-stable X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Nov 2013 12:01:26 -0000 On 28 November 2013 16:03, Schaich Alonso wrote= : > On Thu, 28 Nov 2013 21:47:17 +0100 > Szalai Andr=E1s wrote: > >> Hi Guys, >> >> Has somebody encountered (significantly) different read/write speeds >> when using gmirror? >> >> I have 2xWD WD30EFRX RED drives which are configured as follows: >> >> $ gmirror status >> Name Status Components >> mirror/root COMPLETE ada0p2 (ACTIVE) >> ada1p2 (ACTIVE) >> mirror/data COMPLETE ada0p4 (ACTIVE) >> ada1p4 (ACTIVE) >> >> mirror/root is mounted as the root fs (UFS2). >> >> Doing write: >> >> $ time dd if=3D/dev/zero of=3D/IMAGE bs=3D1024k count=3D`expr 4 \* 1024` >> 4096+0 records in >> 4096+0 records out >> 4294967296 bytes transferred in 29.326044 secs (146455733 bytes/sec) >> >> Doing read: >> >> $ time dd if=3D/IMAGE of=3D/dev/null bs=3D1024k count=3D`expr 4 \* 1024` >> 4096+0 records in >> 4096+0 records out >> 4294967296 bytes transferred in 48.821649 secs (87972598 bytes/sec) >> >> As you can see, read is much slower than write (87 vs 146 MB/s). Why? >> >> Any help would be appreciated. >> >> Best regards, >> Andrew >> >> PS: Partition layout (partitions are 4k aligned): >> >> $ gpart show ada0 ada1 >> =3D> 34 5860533101 ada0 GPT (2.7T) >> 34 6 - free - (3.0k) >> 40 1024 1 freebsd-boot (512k) >> 1064 16777216 2 freebsd-ufs (8.0G) >> 16778280 16777216 3 freebsd-swap (8.0G) >> 33555496 5826977632 4 freebsd-ufs (2.7T) >> 5860533128 7 - free - (3.5k) >> >> =3D> 34 5860533101 ada1 GPT (2.7T) >> 34 6 - free - (3.0k) >> 40 1024 1 freebsd-boot (512k) >> 1064 16777216 2 freebsd-ufs (8.0G) >> 16778280 16777216 3 freebsd-swap (8.0G) >> 33555496 5826977632 4 freebsd-ufs (2.7T) >> 5860533128 7 - free - (3.5k) > > Modern HDDs have both Command Queuing and Excessive Cache Memory. Using t= hem > a spindle disk can cache multiple write requests and do them all in one > revolution. While multiple read requests can also be done at once chances > are the on-disk cache is not usefull (because the requested data is only > resident if it was accessed short before, and then it's also availible in > the kernel's larger Filesystem/GEOM caches which reside in main memory an= d > were consulted prior to disk accesses) and the GEOM layer might not have > issued them yet. IIRC the UFS subsystem will perform no read requests sma= ller > than 512kB by default, which means it does some readahead just in case th= e > issuing application wants to read more data soon - however you have used = read > blocks which are exact multiples of 512kB, so there is no gain in this. > > readahead is the buzzword for tuning large sequencial reads, and I had th= ought > there was a sysctl for it, though I can't find it now. > vfs.read_max, perhaps? IIRC, it's 16 by default, & frequently can improve disk read speed by 100% or more by simply setting it to a larger value. --=20 --