为什么raid0比单盘慢

为什么raid0比单盘慢

这是我的袭击详细信息:

% sudo mdadm --detail --scan
ARRAY /dev/md/blueray-i5:0 metadata=1.2 name=blueray-i5:0 UUID=93a44fb0:9a66b691:f567475e:4a11d39a
% sudo mdadm --detail /dev/md/blueray-i5:0
/dev/md/blueray-i5:0:
           Version : 1.2
     Creation Time : Mon Nov 22 20:03:07 2021
        Raid Level : raid0
        Array Size : 7813769216 (7451.79 GiB 8001.30 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Mon Nov 22 20:03:07 2021
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

            Layout : -unknown-
        Chunk Size : 512K

Consistency Policy : none

              Name : blueray-i5:0  (local to host blueray-i5)
              UUID : 93a44fb0:9a66b691:f567475e:4a11d39a
            Events : 0

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1

这是我的磁盘详细信息:

% lsblk
NAME      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda         8:0    0 232.9G  0 disk
├─sda1      8:1    0   512M  0 part  /boot/efi
└─sda2      8:2    0 232.4G  0 part  /run/timeshift/backup
sdb         8:16   0   3.7T  0 disk
└─sdb1      8:17   0   3.7T  0 part
  └─md127   9:127  0   7.3T  0 raid0 /media/blueray/8TBRaid0
sdc         8:32   0   3.7T  0 disk
└─sdc1      8:33   0   3.7T  0 part
  └─md127   9:127  0   7.3T  0 raid0 /media/blueray/8TBRaid0
sdd         8:48   0   7.3T  0 disk
└─sdd1      8:49   0   7.3T  0 part  /media/blueray/WDPurple8TB
sde         8:64   0   5.5T  0 disk
└─sde1      8:65   0   5.5T  0 part  /media/blueray/WDPurple6TB
% sudo hdparm -I /dev/sdb | grep Rotation (Raid0)
    Nominal Media Rotation Rate: 5400
% sudo hdparm -I /dev/sdc | grep Rotation (Raid0)
    Nominal Media Rotation Rate: 5400
% sudo hdparm -I /dev/sdd | grep Rotation (WDPurple8TB)
    Nominal Media Rotation Rate: 7200    
% sudo hdparm -I /dev/sde | grep Rotation (WDPurple6TB)
    Nominal Media Rotation Rate: 5400

以下是基准:

% dd if=/dev/zero of=/media/blueray/WDPurple8TB/testfile bs=8192 count=102400 oflag=direct
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 6.42835 s, 130 MB/s
% dd if=/media/blueray/WDPurple8TB/testfile of=/dev/null bs=8192 count=102400 iflag=direct
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 6.36915 s, 132 MB/s
% dd if=/dev/zero of=/media/blueray/WDPurple6TB/testfile bs=8192 count=102400 oflag=direct
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 7.47373 s, 112 MB/s
% dd if=/media/blueray/WDPurple6TB/testfile of=/dev/null bs=8192 count=102400 iflag=direct
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 5.56981 s, 151 MB/s    
% dd if=/dev/zero of=/media/blueray/8TBRaid0/testfile bs=8192 count=102400 oflag=direct
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 16.0301 s, 52.3 MB/s
% dd if=/media/blueray/8TBRaid0/testfile of=/dev/null bs=8192 count=102400 iflag=direct
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 14.5726 s, 57.6 MB/s

如您所见,我在 raid0 中有两个 4TB 5400RPM 磁盘。

所有 5 个硬盘都在同一个控制器上,但这个 raid0 的性能比我的 8TB 7200RMP 和 6TB 5400RPM 磁盘差。

为什么会发生这种情况?

更新1

我认为这个问题与缓存

稍微改变了命令,他们给出了更容易接受的答案。请告诉我它们是否是正确的命令,或者可以进行任何修改以使命令更准确(假设我在 raid0 和单个硬盘之间没有发现任何显着的性能差异)。

% dd if=/dev/zero of=/media/blueray/8TBRaid0/testfile bs=8192 count=102400 conv=fdatasync
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 6.51745 s, 129 MB/s
% dd if=/dev/zero of=/media/blueray/WDPurple6TB/testfile bs=8192 count=102400 conv=fdatasync
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 6.02803 s, 139 MB/s
% dd if=/dev/zero of=/media/blueray/WDPurple8TB/testfile bs=8192 count=102400 conv=fdatasync
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 6.88036 s, 122 MB/s

% dd if=/media/blueray/WDPurple6TB/testfile of=/dev/null bs=8192
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 0.199695 s, 4.2 GB/s
% dd if=/media/blueray/WDPurple8TB/testfile of=/dev/null bs=8192
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 0.202408 s, 4.1 GB/s
% dd if=/media/blueray/8TBRaid0/testfile of=/dev/null bs=8192
102400+0 records in
102400+0 records out
838860800 bytes (839 MB, 800 MiB) copied, 0.199696 s, 4.2 GB/s

相关内容