9

I still did not get why is RAID5 better than RAID4. I understand both computes parity bits that are used for recovering if some failure occurs, the only difference is in storing those parity bits. I have borrowed diagrams from here How does parity work on a RAID-5 array

A B (A XOR B)
0 0    0
1 1    0
0 1    1
1 0    1

RAID4

Disk1   Disk2   Disk3   Disk4
----------------------------
data1  data1  data1  parity1
data2  data2  data2  parity2
data3  data3  data3  parity3
data4  data4  data4  parity4

Lets say that first row is:

data1 = 1
data1 = 0
data1 = 1
parity1 = 0 (COMPUTED: 1 XOR 0 XOR 1 = 0)

RAID5

Disk1   Disk2   Disk3   Disk4
----------------------------
parity1 data1   data1   data1   
data2   parity2 data2   data2  
data3   data3   parity3 data3
data4   data4   data4   parity4

Lets say that first row is:

parity1 = 0 (COMPUTED: 1 XOR 0 XOR 1 = 0)
data1 = 1
data1 = 0
data1 = 1

Scanarios:

1. RAID4 - Disk3 FAILURE:

data1 = 1
data1 = 0
data1 = 1 (COMPUTED: 1 XOR 0 XOR 0 = 1)
parity1 = 0

2. RAID4 - Disk4 (parity) FAILURE:

data1 = 1
data1 = 0
data1 = 1 
parity1 = 0 (COMPUTED: 1 XOR 0 XOR 1 = 0)

etc.

In general: when RAID(4 or 5) uses N disks and one fails. I can take all remaining non failed disks (N-1) and XOR (since XOR is associative operation) values and I will get the failed value. What is the benefit of storing parity not on dedicated disk but rather cycle them? Is there some performance benefit or what? Thank you

Wakan Tanka
  • 729
  • 2
  • 13
  • 31

2 Answers2

12

There is a performance difference in that with RAID 4 each change requires writing to the single parity disk, which means things can queue waiting to update the parity data on that disk.

With RAID 5 you have a significant reduction in this because the parity update load is spread across multiple disks, so there's less chance if getting stuck in a queue.

Here's a nice link from Fujitsu with a short explanation and some nice animations to help clarify the performance/penalties of RAID 4 (as well as other RAID levels).

zx485
  • 2,170
  • 11
  • 17
  • 24
Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
-2

OWC has said with their enclosures and using their software SoftRaid, that RAID 4 is faster for reads than RAID 5. Same level of protection, same write speeds, better read speeds, I'm going with RAID 4 in my OWC Thunderbolt 3 enclosure with four NVMe drives.

Zathras
  • 1
  • 1
  • That might be the case for OWC, but it’s not true in general due to the reasons given in zx485’s answer. It would also be a good idea to provide a reference (like a link to the article you’re referring to). – StarCat Apr 11 '20 at 20:49
  • Good point. Here’s a link. https://macperformanceguide.com/Reviews-OWC-Thunderbay4Mini_40TB_SSD-RAID4_RAID5.html Let’s be clear the argument against RAID 4 would be in a situation where a group of users is accessing the data, which can lead to accessing the parity disk slowing things down. In a single user’s situation over a Thunderbolt 3 connection is simply will not be an issue and RAID 4 is likely going to be faster. – Zathras Apr 13 '20 at 01:13