linux raid1读取速度慢,性能 – 为什么我的RAID1读取访问速度比写入访问速度慢?...

我做了一些简单的性能测试,似乎从我的RAID1读取比写入慢:

root@dss0:~# for i in 1 2 3; do dd if=/dev/zero of=/dev/sda bs=1048576 count=131072; done

137438953472 bytes (137 GB) copied, 192.349 s, 715 MB/s

137438953472 bytes (137 GB) copied, 192.851 s, 713 MB/s

137438953472 bytes (137 GB) copied, 193.026 s, 712 MB/s

root@dss0:~# for i in 1 2 3; do dd if=/dev/sda of=/dev/null bs=1048576 count=131072; done

137438953472 bytes (137 GB) copied, 257.201 s, 534 MB/s

137438953472 bytes (137 GB) copied, 255.522 s, 538 MB/s

137438953472 bytes (137 GB) copied, 259.945 s, 529 MB/s

我知道dd不是一个性能测试工具,但这个结果仍然令人惊讶.

系统由供应商构建,并具有带16 GByte RAM的Supermicro主板. RAID控制器是MegaRAID 9271-8i,具有1 GByte缓存. SAS-933EL1背板上有8个2 TByte SAS磁盘.我不确定布线,控制器的一个连接器进入SAS背板,另一个连接到两个容纳操作系统的SATA磁盘.

使用此命令设置RAID1:

root@dss0:~# /opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r1 [8:0,8:1,8:2,8:3,8:4,8:5,8:6,8:7] WB NORA Direct -a0

Adapter 0: Created VD 0

Adapter 0: Configured the Adapter!!

Exit Code: 0x00

root@dss0:~# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aALL

Adapter 0 -- Virtual Drive Information:

Virtual Drive: 0 (Target Id: 0)

Name :

RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0

Size : 7.275 TB

Sector Size : 512

Is VD emulated : No

Mirror Data : 7.275 TB

State : Optimal

Strip Size : 256 KB

Number Of Drives : 8

Span Depth : 1

Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU

Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU

Default Access Policy: Read/Write

Current Access Policy: Read/Write

Disk Cache Policy : Disk's Default

Encryption Type : None

PI type: No PI

Is VD Cached: No

Exit Code: 0x00

我希望读访问至少与写访问一样快,甚至可能更快. 715 MByte / sec的写入速度似乎接近单个SAS / SATA连接器的6 GBit限制.

这可能是SAS背板的配置或布线问题吗?可以使用MegaRAID命令查询SAS背板配置吗?

请指教.

更新

正如poige和Peter所做的那样,读取性能低于预期可能是由于Linux I / O子系统的缓存造成的.

当我在dd命令中使用direct flag时

root@dss0:~# dd if=/dev/sda of=/dev/null bs=1048576 count=131072 iflag=direct

137438953472 bytes (137 GB) copied, 199.862 s, 688 MB/s

这比写入速度慢得多但速度慢了10%.使用oflag = direct不会影响写入速度.