磁盘存储性能测试


测试方案

  1. 两个维度
    随机读写频繁的应用,如小文件存储(图片)、OLTP数据库、邮件服务器,关注随机读写性能,IOPS是关键衡量指标。
    顺序读写频繁的应用,传输大量连续数据,如电视台的视频编辑,视频点播VOD(Video On Demand),关注连续读写性能。数据吞吐量是关键衡量指标。
  2. 物理磁盘的IOPS性能上限
    IOPS = 1000 ms/ (寻道时间 + 旋转延迟)。可以忽略数据传输时间。
    7200 rpm的磁盘IOPS = 1000 / (9 + 4.17) = 76 IOPS
    10000 rpm的磁盘IOPS = 1000 / (6+ 3) = 111 IOPS
    15000 rpm的磁盘IOPS = 1000 / (4 + 2) = 166 IOPS

测试准备

  1. 磁盘型号
    fdisk -l //磁盘编号
    smartctl --all /dev/sda
  2. 挂载明细
    df -h
  3. 判断是否是固态硬盘
    lsblk -d -o name,rota 判断是否是sdd,1 是HDD, 0是SSD
  4. 准备大文件
    dd if=/dev/zero of=/bdata/test.big bs=4k count=524288 # 通常在需要测试的那个磁盘下面生成一个这种测试用的大文件2G
    dd if=/dev/zero of=ftest.big bs=4k count=262144
  5. 软件
    fio 测IOPS
    iozone 测吞吐量

fio 测试

  1. 异步随机读写,读占比70 (一般用这个)
    fio -direct=1 -filename=/home/puppy/fio/test.big -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=libaio -bs=4k -size=2G -numjobs=1 -runtime=180 -group_reporting -name=randrw_70read_4k
  2. 同步随机读写,读占比70
    fio -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=4k -size=1G -numjobs=1 -runtime=180 -group_reporting -name=randrw_70read_4k

iozone测试

  1. iozone -a -n 512m -g 4g -i 0 -i 1 -f iozone -Rb iozone.xls

你可能感兴趣的:(磁盘存储性能测试)