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时候写性能最佳
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值