请注意。长读。
在我计划在我的 Ceph 设置中使用的 Hitachi Ultrastar 7K6000 驱动器的初始性能测试期间,我注意到一个奇怪的事情:禁用磁盘写入缓存时写入性能更好。
我使用fio:
fio --filename=/dev/sda --direct=1 --sync=1 --rw=randwrite --bs=4k --numjobs=1 --iodepth=1 --runtime=60 --time_based --group_reporting --name=4krandw
Run Code Online (Sandbox Code Playgroud)
当写缓存被禁用时:
hdparm -W 0 /dev/sda
4krandw: (groupid=0, jobs=1): err= 0: pid=6368: Thu Jun 22 07:36:44 2017
write: io=63548KB, bw=1059.9KB/s, iops=264, runt= 60003msec
clat (usec): min=473, max=101906, avg=3768.57, stdev=11923.0
Run Code Online (Sandbox Code Playgroud)
启用写缓存时:
hdparm -W 1 /dev/sda
4krandw: (groupid=0, jobs=1): err= 0: pid=6396: Thu Jun 22 07:39:14 2017
write: io=23264KB, bw=397005B/s, iops=96, runt= 60005msec
clat (msec): min=1, max=48, avg=10.30, stdev= 4.12 …Run Code Online (Sandbox Code Playgroud)