HostOnNet Blog

Raid 1 vs Single Disk Speed Test

Looking for Linux Server Admin or WordPress Expert? We can help.

I was trying to moving my /home directory to new btrfs raid 1 partition. Raid 1 is knowing as Mirroring, data is written to 2 disks. Data written to a Raid 1 array is like 10% slower than single hard disk. Since data can be read from any of the disk, read performance can be 2x faster.

Here is result of

hdparm -Tt /dev/sda

Both HDD in raid are same model.

root@hon-pc-01:~# hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   15938 MB in  2.00 seconds = 7974.57 MB/sec
 Timing buffered disk reads: 410 MB in  3.02 seconds = 135.99 MB/sec
root@hon-pc-01:~# 

Raid 1 Vs Single Disk – Write Speed

Here is a speed test using dd command.

root@hon-pc-01:~# cd /home/
root@hon-pc-01:/home# dd if=/dev/zero of=hon-test bs=64k count=16k conv=fdatasync && rm -f hon-test
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.9015 s, 90.2 MB/s
root@hon-pc-01:/home# cd /mnt/new-home/
root@hon-pc-01:/mnt/new-home# dd if=/dev/zero of=hon-test bs=64k count=16k conv=fdatasync && rm -f hon-test
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.9658 s, 89.7 MB/s
root@hon-pc-01:/mnt/new-home# 

Here /home is single disk and /mnt/new-home is 2 disks in btrfs raid 1 mode.

As you can see single drive have 90.2 MB/s and Raid 1 have 89.7 MB/s.

Raid 1 Vs Single Disk – Read Speed

This is supposed to get 2x speed. But i get slower speed. Command used to test is

sync && echo 3 > /proc/sys/vm/drop_caches && dd if=/home/1.mp4 of=/dev/null bs=4k
sync && echo 3 > /proc/sys/vm/drop_caches && dd if=/mnt/new-home/1.mp4 of=/dev/null bs=4k
root@hon-pc-01:~# sync && echo 3 > /proc/sys/vm/drop_caches && dd if=/home/1.mp4 of=/dev/null bs=4k
82230+1 records in
82230+1 records out
336815757 bytes (337 MB, 321 MiB) copied, 2.23015 s, 151 MB/s
root@hon-pc-01:~# sync && echo 3 > /proc/sys/vm/drop_caches && dd if=/mnt/new-home/1.mp4 of=/dev/null bs=4k
82230+1 records in
82230+1 records out
336815757 bytes (337 MB, 321 MiB) copied, 3.47509 s, 96.9 MB/s
root@hon-pc-01:~# 

The btrfs raid 1 speed i get is like 50% less than single disk while i am supposed to get 2X speed.

I asked in btrfs IRC, some told this is because the partition used by /mnt/new-home is far from beginning of the disk.

<zdzichu> I guess this is on spinning rust and /mnt/new-home is further from the beginning of disk

I never thought of this. On a hard disk, reading data from outer tracks can take more time than reading from inner tracks. My /home is on /dev/sdb3 and /mnt/new-home i on /dev/sdb4 and /dev/sda5

NOTE: This test doesn’t prove anything as for a proper comparison of raid 1 vs single disk performance, it need to be done on a disk where both single and raid 1 partitions use similar tracks.

hdd

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.