当前位置:   article > 正文

KVM Disk Cache模式对性能的影响

kvm disk cache

操作环境

Centos 6.6

qemu-kvm-0.12.1.2

fio 2.0.13

操作说明



KVM的Disk的Cache模式有3种
  • none
  • writeback
  • writethrough
3种cache模式的io路径如上图所示。

此次测试通过fio分别对该3种cache模式进行测试,包括顺序读(sr),顺序写(sw),随机读(rr),随机写(rw)。

测试脚本如下
#!/bin/bash
function tgt_r {
fio -filename=/dev/vdb -direct=1 -iodepth 64 -thread -rw=read -ioengine=libaio -bs=$1 -size=100G  -runtime=60 -group_reporting -name=mytest &>> s_r_test
}

function tgt_w {
fio -filename=/dev/vdb -direct=1 -iodepth 64 -thread -rw=write -ioengine=libaio -bs=$1 -size=100G  -runtime=60 -group_reporting -name=mytest &>> s_w_test
}


function tgt_rr {
fio -filename=/dev/vdb -direct=1 -iodepth 64 -thread -rw=randread -ioengine=libaio -bs=$1 -size=100G  -runtime=60 -group_reporting -name=mytest &>> r_r_test
}

function tgt_rw {
fio -filename=/dev/vdb -direct=1 -iodepth 64 -thread -rw=randwrite -ioengine=libaio -bs=$1 -size=100G  -runtime=60 -group_reporting -name=mytest &>> r_w_test
}

tgt_r 512K
tgt_w 512K
tgt_rr 512K
tgt_rw 512K


fio 参数说明
ioengine: 负载引擎,使用libaio,发起异步IO请求。
bs: IO大小
direct: 直写,绕过操作系统Cache。
rw: 读写模式,有顺序写write、顺序读read、随机写randwrite、随机读randread等。
size: 寻址空间,IO会落在 [0, size)这个区间的硬盘空间上,一般设置为硬盘的大小。
filename: 测试对象
iodepth: 队列深度
runtime: 测试时长

测试结果
MBPS(KB/s)



IOPS


latency(ms)


通过上述测试可得知,cache mode为none的时候读的性能最佳,cache mode为writeback时候写性能最佳
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/217517
推荐阅读
相关标签
  

闽ICP备14008679号