【转】Fio性能相关参数详解

1、背景

fio涉及到随机读、随机写的参数有这么几个,他们对fio的randwrite和randread时候随机的io的位置有关

  • randrepeat
  • allrandrepeat
  • randseed
  • random_distribution
  • random_generator
  • norandommap
  • softrandommap
    这些参数都有独立的作用,同时互相之间又有影响,我阅读了fio-3.2和fio-3.7的源码,总结了这些参数的用法如下

2、随机读写的一些相关参数

在fio的测试参数中这几个参数会决定在哪个范围内做随机的io

  • size:产生随机读写的起始范围从offset(起始lba)到offset+size(终止lba)
  • io_size:在这段size中产生多少io,如果不指定io_size,io_size默认等于size
  • offset:略
debug fio的随机读写的方法
加上debug参数执行测试,可以看到每个随机出来的单独的io_u使用的lba地址
fio --debug=io,random jobfile

3、randrepeat和allrandrepeat

randrepeat的意思其实非常的简单:就是说这次随机读、随机写测试产生的位置是可重复的。这里的“可重复”的实现方式仅仅是通过randseed=默认值来实现。

  • randrepeat:默认是True
  • allrandrepeat:这个参数没什么用,估计废弃了吧
  • randrepeat & randseed=XX : 如果randseed设置了自定义的值,randrepeat将强制变成False,如果randseed没有设置值(默认137)randrepeat=1,那么这个设置不言而喻,相当于每次都用同样的randseed,当然就是randrepeatable的测试。
  • randrepeat=0 & randseed=None: 如果测试的时候randrepeat设置为false,同时也没有指定seed,这个时候randseed就是去读/dev/urandom文件获取一个随机的seed

4、random_generator

随机数的生成器一共有三个,tausworthe(默认)、tausworthe64、lfsr
fio文档里面的解释非常清晰:

tausworthe  is  a  strong  random number generator, but it requires tracking on the side if we want to ensure that blocks are only read or written once. 
lfsr guarantees that we never generate the same offset twice, and it's also less computationally expensive. It's not a true random generator, 
however, though for I/O purposes it's typically good enough. lfsr only works with single block sizes, not with workloads that use multiple block sizes. 
If used with such a workload, fio may read or write some blocks multiple times. The default value is tausworthe,  unless  the  required  
space exceeds 2^32 blocks. If it does, then tausworthe64 is selected automatically.

5、random_distribution

随机分布参数指的是,fio可以模拟某些lba区域的随机概率高,某些区域随机概率低,模拟随机数据的冷热性。

  • random: 均匀分布(默认)
  • zipf:zipf分布
  • pareto:帕累托分布
  • zoned :直接某个区域内指定io的多少
  • narmal:高斯分布
    注意:后面这几个分布各有不同,其实达到的目的都很类似,如果使用了非均匀分布的参数,会强制指定norandommap=1,这些非均匀分布和randommap要实现的目的是冲突的。

6、norandommap和softrandommap

norandommap:如果不加这个参数,fio执行随机的时候就是有randommap的,fio会使用一段内存(bitmap)来记录是不是随机到重复的位置,如果随机到重复的位置,那么fio会再去找一个不重复的位置。如果设置了这个参数,同时配合上真随机random_generator,那么会产生重复位置的io_u

注意:

  • 有的random_generator产生的随机数是伪随机的,不会随机到重复位置,例如lfsr
  • 有的random_generator产生真随机数,需要有这个randommap来保障不随机到重复位置,例如tausworthe
  • 如果random_distribution的值不是random,那么这个随机读写的分布就不是均匀分布,norandommap=True
  • softrandommap:默认是disable的,如果设置为1,实现的功能很简单,randommap是需要占用内存资源的,在某些情况下如果allocate bit map的内存失败,那么测试自动转为norandommap,并且不会报错。softrandommap如果disable,fio在分配内存失败之后会报错退出



作者:Stansosleepy
链接:https://www.jianshu.com/p/94ac980ed29e
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值