Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Nov 2013 07:01:25 -0500
From:      "illoai@gmail.com" <illoai@gmail.com>
To:        Schaich Alonso <alonsoschaich@fastmail.fm>
Cc:        ml-freebsd-stable <freebsd-stable@freebsd.org>
Subject:   Re: gmirror: writes are faster than reads
Message-ID:  <CAHHBGkqtXud0S%2BGbw1=VTJZcGvpER=mJneUZ4xUUFoyz_PzXLg@mail.gmail.com>
In-Reply-To: <20131128220305.e715adb95b16f494224052f5@fastmail.fm>
References:  <5297ABD5.5060504@gmail.com> <20131128220305.e715adb95b16f494224052f5@fastmail.fm>

next in thread | previous in thread | raw e-mail | index | archive | help
On 28 November 2013 16:03, Schaich Alonso <alonsoschaich@fastmail.fm> wrote=
:
> On Thu, 28 Nov 2013 21:47:17 +0100
> Szalai Andr=E1s <szalai.bandi@gmail.com> 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
--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHHBGkqtXud0S%2BGbw1=VTJZcGvpER=mJneUZ4xUUFoyz_PzXLg>