LSI RAID:写缓存策略影响读性能?

tlo*_*tlo 6 raid performance lsi megaraid hardware-raid

我有一台带有 LSI MegaRAID SAS 9260-4i 控制器的服务器,RAID-5 带有 3 x 2 TB 磁盘。我做了一些性能测试(使用 iozone3),数字清楚地表明写入缓存策略也会影响读取性能。如果我将策略设置为 WriteBack,与 WriteThrough 相比,读取性能提高了大约 2 倍。写缓存如何影响读性能?

以下是设置的详细信息:

megacli -LDInfo -L0 -a0

Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-5, Secondary-0, RAID Level Qualifier-3
Size                : 3.637 TB
Is VD emulated      : Yes
Parity Size         : 1.818 TB
State               : Optimal
Strip Size          : 512 KB
Number Of Drives    : 3
Span Depth          : 1
Default Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disabled
Encryption Type     : None
Bad Blocks Exist: No
Is VD Cached: No
Run Code Online (Sandbox Code Playgroud)

启用 WriteBack(其他一切不变):

Default Cache Policy: WriteBack, ReadAhead, Direct, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, Write Cache OK if Bad BBU
Run Code Online (Sandbox Code Playgroud)

iozone3 中的一些数字:

 WriteThrough:
                                                    random  random
      KB  reclen   write rewrite    read    reread    read   write
 2033120      64   91963   38146   144980   139122   11795   21564
 2033120     128   83039   90746   118660   118147   21193   33686
 2033120     256   78933   40359   113611   114327   31493   51838
 2033120     512   71133   39453   131113   143323   28712   60946
 2033120    1024   91233   76601   141257   142820   35869   45331
 2033120    2048   58507   48419   136078   135220   51200   54548
 2033120    4096   98426   70490   119342   134319   80883   57843
 2033120    8192   70302   63047   132495   144537  101882   57984
 2033120   16384   79594   29208   148972   135650  124207   79281

 WriteBack:
                                                    random  random
      KB  reclen   write rewrite    read    reread    read   write
 2033120      64  347208  302472   331824   302075   12923   31795
 2033120     128  354489  343420   292668   322294   24018   45813
 2033120     256  379546  343659   320315   302126   37747   71769
 2033120     512  381603  352871   280553   322664   33192  116522
 2033120    1024  374790  349123   289219   290284   43154  232669
 2033120    2048  364758  342957   297345   320794   73880  264555
 2033120    4096  368939  339926   303161   324334  128764  281280
 2033120    8192  374004  346851   303138   326100  186427  324315
 2033120   16384  379416  340577   284131   289762  254757  356530
Run Code Online (Sandbox Code Playgroud)

关于系统的一些细节:

  • Ubuntu 12.04
  • 64位
  • 内核 3.2.0 (3.2.0-58-generic)
  • 测试的内存限制为 1 GB
  • iozone3 版本 397-2
  • 用于测试的分区: /dev/sda4 /var ext4 rw,relatime,user_xattr,barrier=1,data=ordered 0 0

Han*_* S. 2

此测试在什么文件系统上运行?

我想到的是时间。如果您的文件系统使用 atime 选项挂载或缺少 no/relatime 挂载选项,则每次读取都会获得写入。

(atime表示记录文件的最后访问时间)

如果您发布以下输出可能会有所帮助

mount
Run Code Online (Sandbox Code Playgroud)

并指定您在哪个设备上进行测试。