nn4*_*n4l 10 raid performance storage megaraid
我做了一些简单的性能测试,似乎从我的 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
Run Code Online (Sandbox Code Playgroud)
我理解dd不是性能测试工具,但是这个结果还是很意外的。
系统由供应商构建,并具有带 16 GByte RAM 的 Supermicro 主板。RAID 控制器是具有 1 GB 缓存的 MegaRAID 9271-8i。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
Run Code Online (Sandbox Code Playgroud)
我希望读访问至少与写访问一样快,甚至可能更快。715 兆字节/秒的写入速度似乎接近单个 SAS/SATA 连接器的 6 GBit 限制。这可能是 SAS 背板的配置或布线问题吗?是否可以使用 MegaRAID 命令查询 SAS 背板配置?请指教。
正如 poige 和 Peter 所解释的,低于预期的读取性能可能是由于 Linux I/O 子系统的缓存造成的。
在 dd 命令中使用直接标志时,我得到
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
Run Code Online (Sandbox Code Playgroud)
这要好得多,但仍然比写入速度慢 10%。使用 oflag=direct 不会影响写入速度。
poige 关于写缓存是完全正确的,但这里有更多细节。
dd 带零并使用写缓存不是进行基准测试的正确方法(除非您当然想测试写缓存,这可能仅对文件系统有用,以查看它同步元数据、创建新文件等的程度。 )(可能 dd 总是错误的基准测试类型,但它适用于非常基本的测试)
我建议您使用 dd 至少具有以下选项之一:
conv=fdatasync -> this will make it flush to disk before finishing and calculating speed
oflag=direct -> this will make it skip the OS cache but not the disk cache
conv=sync -> more like skipping the disk cache too, but not really ... just flushing it every block or something like that.
Run Code Online (Sandbox Code Playgroud)
也不要使用零。如果数据像零一样可预测,一些智能硬件/软件/固件可能会使用一些快捷方式。如果存在我猜您没有使用的压缩,则尤其如此。相反,使用内存中的随机文件(例如 /dev/shm)。urandom 很慢,所以你需要暂时把它写在某个地方才能再次读取它。创建一个 50MB 的随机文件:
dd if=/dev/urandom of=/dev/shm/randfile bs=1M count=50
Run Code Online (Sandbox Code Playgroud)
多次读取文件进行写入(这里我使用cat读取了6次):
dd if=<(cat /dev/shm/randfile{,,,,,}) of= ... conv=fdatasync
rm /dev/shm/randfile
Run Code Online (Sandbox Code Playgroud)
还要记住,raid1 读取在并行操作中速度最快,因此可以独立使用磁盘。协调磁盘以使用不同磁盘读取同一操作的不同部分可能不够聪明。
| 归档时间: |
|
| 查看次数: |
2882 次 |
| 最近记录: |