Skip to contentSkip to conversation

Raid sync observations

DISCUSSION Sebastian Kuzminsky 6 participants 9 messages Dec 20, 2005 – Jan 8, 2006 MD RAID

lore
Share & tools
lore
#0 lore raw

I just created a RAID array (4-disk RAID-6). When "mdadm -C" returned, /proc/mdstat showed it syncing the new array at about 17 MB/s. "vmstat 1" showed hardly any blocks in or out, and an almost completely idle cpu.

Question 1: Why didnt the raid sync I/O show up with vmstat?

Question 2: Why was it limited to 17 MB per second? The maximum was left at the default, 200 MB/s. The min was also at the default, 1 MB/s. I get 60 MB/s per disk with "hdparm -tT" (that's using one disk at a time, but still). The checksumming code does > 3 GB/s.

Just curious really. This is with 2.6.15-rc5 and SATA disks via libata.

Signature · 1 line
Sebastian Kuzminsky
#1 lore raw
Quoted 6 lines · Sebastian Kuzminsky

Question 1: Why didnt the raid sync I/O show up with vmstat?

Question 2: Why was it limited to 17 MB per second? The maximum was left at the default, 200 MB/s. The min was also at the default, 1 MB/s. I get 60 MB/s per disk with "hdparm -tT" (that's using one disk at a time, but still). The checksumming code does > 3 GB/s.

Some more info... vmstat doesnt see it, but "iostat -m" does:

avg-cpu: %user %nice %system %iowait %steal %idle

           0.00    0.00    3.96    0.00    0.00   96.04
Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
hda               0.00         0.00         0.00          0          0
hde               0.00         0.00         0.00          0          0
hdg               0.00         0.00         0.00          0          0
hdi               0.00         0.00         0.00          0          0
hdk               0.00         0.00         0.00          0          0
sda             201.00        18.06         8.56         18          8
sdb             184.00        18.06         8.62         18          8
sdc             209.00        18.06         8.59         18          8
sdd             151.00        17.16         9.00         17          9
md0               0.00         0.00         0.00          0          0
md1               0.00         0.00         0.00          0          0

hda is the system disk, hd[egik] are PATA disks that make up md0, and sd[abcd] are SATA disks that make up md1. md0 is idle, md1 is syncing.

This all makes more sense now - it's only getting 18 MB/s because it's spending all that time writing.

But wait, why is it only writing half as much as it reads? This is a 4-disk RAID-6, as I understand it, it should read 2 strips and write 2 strips per stripe.

Signature · 1 line
Sebastian Kuzminsky
#2 lore raw
In reply to Sebastian Kuzminsky
Quoted 6 lines · On Tuesday December 20, [email protected] wrote:

I just created a RAID array (4-disk RAID-6). When "mdadm -C" returned, /proc/mdstat showed it syncing the new array at about 17 MB/s. "vmstat 1" showed hardly any blocks in or out, and an almost completely idle cpu.

Question 1: Why didnt the raid sync I/O show up with vmstat?

Because resync does use the 'vm' subsystem. It uses a private memory pool. So it doesn't page-in or page-out.
As has been noted, the IO it appears in iostat.

Quoted 7 lines

Question 2: Why was it limited to 17 MB per second? The maximum was left at the default, 200 MB/s. The min was also at the default, 1 MB/s. I get 60 MB/s per disk with "hdparm -tT" (that's using one disk at a time, but still). The checksumming code does > 3 GB/s.

This has been at least partially answered already, however...

When doing resync, raid6 will read all the data blocks, calculate the P and Q syndromes, and then write those out.
If you think about head movement remembering that the devices holding P and Q differs for each stripe, you will realise that the drives are not streaming, so you will miss out on some speed.

You can get better speed on creation with
mdadm -C -l6 -n4 -x2 /dev/sd[ab] missing missing /dev/sd[cd]

i.e. create with 2 missing devices and 2 spares. Recovery onto the spares will do purely sequential IO on all devices and so will go much faster.
Doing this requires regenerating datablocks which is more cpu intensive that generating P and Q, so there might be some CPU overhead, but the disk throughput is still much faster.

In 2.6.16, raid6 resync has been improved somewhat. This will not affect the initial sync, but resync after a crash will only write P/Q blocks which are wrong and there are usually very few of those. This means that it will mostly to sequential reads on all drives, so you get full device speed.

NeilBrown

#3 lore raw
Quoted 10 lines · Neil Brown

You can get better speed on creation with
mdadm -C -l6 -n4 -x2 /dev/sd[ab] missing missing /dev/sd[cd]

i.e. create with 2 missing devices and 2 spares. Recovery onto the spares will do purely sequential IO on all devices and so will go much faster.
Doing this requires regenerating datablocks which is more cpu intensive that generating P and Q, so there might be some CPU overhead, but the disk throughput is still much faster.

Quoted 5 lines

In 2.6.16, raid6 resync has been improved somewhat. This will not affect the initial sync, but resync after a crash will only write P/Q blocks which are wrong and there are usually very few of those. This means that it will mostly to sequential reads on all drives, so you get full device speed.

Thanks!!

Signature · 1 line
Sebastian Kuzminsky
#4 lore raw
In reply to Sebastian Kuzminsky
Quoted 3 lines · Sebastian Kuzminsky

I just created a RAID array (4-disk RAID-6). When "mdadm -C" returned, /proc/mdstat showed it syncing the new array at about 17 MB/s. "vmstat 1" showed hardly any blocks in or out, and an almost completely idle cpu.

This isn't really relevant to your questions but...

Why would you use RAID6 and not RAID10 with four disks ?

CS

#5 lore raw
Quoted 8 lines · Christopher Smith
Quoted 3 lines · Sebastian Kuzminsky

I just created a RAID array (4-disk RAID-6). When "mdadm -C" returned, /proc/mdstat showed it syncing the new array at about 17 MB/s. "vmstat 1" showed hardly any blocks in or out, and an almost completely idle cpu.

This isn't really relevant to your questions but...

Why would you use RAID6 and not RAID10 with four disks ?

I was wondering the same thing. It's true that RAID6 is guaranteed to still run degraded after losing 2 devices, whereas a RAID10 on 4 devices could only lose 1 device from each RAID1. So there is some small extra redundancy there.

But how does the performance for read and write compare?

#6 lore raw
Quoted 7 lines · Andy Smith
Quoted 1 line · Christopher Smith

Why would you use RAID6 and not RAID10 with four disks ?

I was wondering the same thing. It's true that RAID6 is guaranteed to still run degraded after losing 2 devices, whereas a RAID10 on 4 devices could only lose 1 device from each RAID1. So there is some small extra redundancy there.

That's the reason - better reliability. With 4-disk RAID-10, a 2-disk failure has a 1/3 chance of causing array failure. With RAID-6, there is no chance.

Quoted 1 line

But how does the performance for read and write compare?

Good question! I'll post some performance numbers of the RAID-6 configuration when I have it up and running.

Signature · 1 line
Sebastian Kuzminsky
#7 lore raw
Quoted 4 lines · Sebastian Kuzminsky
Quoted 1 line

But how does the performance for read and write compare?

Good question! I'll post some performance numbers of the RAID-6 configuration when I have it up and running.

Post your hardware config too if you don't mind. I have one server with 8 drives and for swap (Which it never does!) I created 2 x 4 disk RAID 6 arrays (same partition on all disks) and gave them to the kernel with equal priority

Filename                                Type            Size    Used    Priority
/dev/md10                               partition       1991800 0       1
/dev/md11                               partition       1991800 0       1

md10 : active raid6 sdd2[3] sdc2[2] sdb2[1] sda2[0]

      1991808 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]

md11 : active raid6 sdh2[3] sdg2[2] sdf2[1] sde2[0]

      1991808 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]

/dev/md10:
Timing buffered disk reads: 64 MB in 0.66 seconds = 97.28 MB/sec

/dev/md11:
Timing buffered disk reads: 64 MB in 0.95 seconds = 67.59 MB/sec

md10 is an on-board 4-port SII SATA controller, md11 is 2 x 2-port SII PCI cards. (Server is currently moderately loaded, so results are a bit lower than usual

Cue the must/must not swap on RAID arguments ;-)

Happy Solstice!

Gordon

#8 lore raw
Quoted 30 lines · Gordon Henderson
Quoted 7 lines · Sebastian Kuzminsky
Quoted 3 lines

But how does the performance for read and write compare?

Good question! I'll post some performance numbers of the RAID-6 configuration when I have it up and running.

Post your hardware config too if you don't mind. I have one server with 8 drives and for swap (Which it never does!) I created 2 x 4 disk RAID 6 arrays (same partition on all disks) and gave them to the kernel with equal priority

Filename                                Type            Size    Used    Priority
/dev/md10                               partition       1991800 0       1
/dev/md11                               partition       1991800 0       1

md10 : active raid6 sdd2[3] sdc2[2] sdb2[1] sda2[0]

     1991808 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]

md11 : active raid6 sdh2[3] sdg2[2] sdf2[1] sde2[0]

     1991808 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]

/dev/md10:
Timing buffered disk reads: 64 MB in 0.66 seconds = 97.28 MB/sec

Quoted 9 lines

/dev/md11:
Timing buffered disk reads: 64 MB in 0.95 seconds = 67.59 MB/sec

md10 is an on-board 4-port SII SATA controller, md11 is 2 x 2-port SII PCI cards. (Server is currently moderately loaded, so results are a bit lower than usual

Cue the must/must not swap on RAID arguments ;-)

I wouldn't swap on RAID-6... performance is importand, swap is tiny compared to disk size. I would go to 2GB partitions and four-way RAID-1, since fast swap in seems to make for better "feel" and write is cached somewhat.

Signature · 3 lines
bill davidsen <[email protected]>
 CTO TMR Associates, Inc
 Doing interesting things with small computers since 1979