Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Nov 2013 22:03:05 +0100
From:      Schaich Alonso <alonsoschaich@fastmail.fm>
To:        freebsd-stable@freebsd.org
Subject:   Re: gmirror: writes are faster than reads
Message-ID:  <20131128220305.e715adb95b16f494224052f5@fastmail.fm>
In-Reply-To: <5297ABD5.5060504@gmail.com>
References:  <5297ABD5.5060504@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 28 Nov 2013 21:47:17 +0100
Szalai Andr=C3=A1s <szalai.bandi@gmail.com> wrote:

> Hi Guys,
>=20
> Has somebody encountered (significantly) different read/write speeds
> when using gmirror?
>=20
> I have 2xWD WD30EFRX RED drives which are configured as follows:
>=20
> $ gmirror status
>         Name    Status  Components
> mirror/root  COMPLETE  ada0p2 (ACTIVE)
>                         ada1p2 (ACTIVE)
> mirror/data  COMPLETE  ada0p4 (ACTIVE)
>                         ada1p4 (ACTIVE)
>=20
> mirror/root is mounted as the root fs (UFS2).
>=20
> Doing write:
>=20
> $ 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)
>=20
> Doing read:
>=20
> $ 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)
>=20
> As you can see, read is much slower than write (87 vs 146 MB/s). Why?
>=20
> Any help would be appreciated.
>=20
> Best regards,
> Andrew
>=20
> PS: Partition layout (partitions are 4k aligned):
>=20
> $ 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)
>=20
> =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 them
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 and
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 small=
er
than 512kB by default, which means it does some readahead just in case the
issuing application wants to read more data soon - however you have used re=
ad
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 thou=
ght
there was a sysctl for it, though I can't find it now.

Alonso



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131128220305.e715adb95b16f494224052f5>