読者です 読者をやめる 読者になる 読者になる

5400rpm

人生シングルスレッド

続・discardオプション追試

経緯と前回までの記事リンク

  • discardオプションの影響を試そうとしたがxfsとext4で実施しており比較として成立していなかった

  • xfsでの様々なパターンは取得したので次はext4にて同様のベンチマークを実施、改めて比較する

    • ファイルシステム以外のfio実施設定、テストコマンドなどは二回目と同一
    • 前回ログを垂れ流しでsshクライアント側のwindows落とせなかったので今回はteeコマンド利用
      • もちろんIOPSに影響がないようテスト用のsda ではなく sdb に吐いてます

再フォーマットからdiscardでマウント

[comicsong@comicsong fio]$ sudo /sbin/mkfs.ext4 /dev/sda1
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
15630336 inodes, 62514432 blocks
3125721 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2210398208
1908 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
  • discardを有効にしてマウント
[comicsong@comicsong fio]$ sudo mount -t ext4 -o noatime,discard /dev/sda1 /mnt/SSD/
[comicsong@comicsong fio]$ sudo mkdir -p /mnt/SSD/fio/tmp/
[comicsong@comicsong fio]$ sudo chmod 757 /mnt/SSD/fio/tmp/
[comicsong@comicsong fio]$ mount | grep sda
/dev/sda1 on /mnt/SSD type ext4 (rw,noatime,discard,data=ordered)
  • テスト実施。
for TEST in read write readwrite randread randwrite randrw
  do for NUM in {1..5}
    do echo -n "${TEST}_${NUM} :"
    fio fio.ini -rw ${TEST} | tee -a /home/comicsong/fio/ext4_discard_off.log | grep "iops="
    /bin/rm -r /mnt/SSD/fio/tmp/*
  done
  echo "----------------------"
done

discard有効

read_1 :  read : io=8095.2MB, bw=92103KB/s, iops=23025, runt= 90002msec
read_2 :  read : io=10819MB, bw=123091KB/s, iops=30772, runt= 90001msec
read_3 :  read : io=9011.8MB, bw=102531KB/s, iops=25632, runt= 90002msec
read_4 :  read : io=11142MB, bw=126769KB/s, iops=31692, runt= 90001msec
read_5 :  read : io=10866MB, bw=123633KB/s, iops=30908, runt= 90002msec
----------------------
write_1 :  write: io=9768.2MB, bw=111148KB/s, iops=27787, runt= 90001msec
write_2 :  write: io=9837.6MB, bw=111923KB/s, iops=27980, runt= 90001msec
write_3 :  write: io=9809.2MB, bw=111603KB/s, iops=27900, runt= 90002msec
write_4 :  write: io=9856.8MB, bw=112145KB/s, iops=28036, runt= 90002msec
write_5 :  write: io=9809.3MB, bw=111607KB/s, iops=27901, runt= 90001msec
----------------------
readwrite_1 :  read : io=984416KB, bw=10937KB/s, iops=2734, runt= 90009msec
  write: io=985968KB, bw=10954KB/s, iops=2738, runt= 90009msec
readwrite_2 :  read : io=993972KB, bw=11042KB/s, iops=2760, runt= 90017msec
  write: io=996060KB, bw=11065KB/s, iops=2766, runt= 90017msec
readwrite_3 :  read : io=985148KB, bw=10945KB/s, iops=2736, runt= 90007msec
  write: io=986692KB, bw=10962KB/s, iops=2740, runt= 90007msec
readwrite_4 :  read : io=990192KB, bw=11001KB/s, iops=2750, runt= 90007msec
  write: io=991952KB, bw=11021KB/s, iops=2755, runt= 90007msec
readwrite_5 :  read : io=989020KB, bw=10988KB/s, iops=2747, runt= 90007msec
  write: io=990728KB, bw=11007KB/s, iops=2751, runt= 90007msec
----------------------
randread_1 :  read : io=11104MB, bw=126339KB/s, iops=31584, runt= 90001msec
randread_2 :  read : io=11109MB, bw=126396KB/s, iops=31599, runt= 90001msec
randread_3 :  read : io=11099MB, bw=126279KB/s, iops=31569, runt= 90001msec
randread_4 :  read : io=11100MB, bw=126292KB/s, iops=31572, runt= 90001msec
randread_5 :  read : io=11101MB, bw=126299KB/s, iops=31574, runt= 90002msec
----------------------
randwrite_1 :  write: io=9887.9MB, bw=112499KB/s, iops=28124, runt= 90002msec
randwrite_2 :  write: io=9938.8MB, bw=113070KB/s, iops=28267, runt= 90002msec
randwrite_3 :  write: io=9940.5MB, bw=113097KB/s, iops=28274, runt= 90002msec
randwrite_4 :  write: io=9931.4MB, bw=112994KB/s, iops=28248, runt= 90002msec
randwrite_5 :  write: io=9897.5MB, bw=112609KB/s, iops=28152, runt= 90002msec
----------------------
randrw_1 :  read : io=1029.6MB, bw=11711KB/s, iops=2927, runt= 90023msec
  write: io=1030.7MB, bw=11724KB/s, iops=2930, runt= 90023msec
randrw_2 :  read : io=1022.8MB, bw=11635KB/s, iops=2908, runt= 90016msec
  write: io=1023.8MB, bw=11646KB/s, iops=2911, runt= 90016msec
randrw_3 :  read : io=1023.8MB, bw=11647KB/s, iops=2911, runt= 90004msec
  write: io=1024.6MB, bw=11656KB/s, iops=2914, runt= 90004msec
randrw_4 :  read : io=1032.9MB, bw=11750KB/s, iops=2937, runt= 90009msec
  write: io=1033.9MB, bw=11762KB/s, iops=2940, runt= 90009msec
randrw_5 :  read : io=1031.6MB, bw=11733KB/s, iops=2933, runt= 90023msec
  write: io=1032.7MB, bw=11746KB/s, iops=2936, runt= 90023msec
----------------------

discardオプションを無効化して再マウント

[comicsong@comicsong fio]$ sudo umount /mnt/SSD
[comicsong@comicsong fio]$ sudo mount -o noatime /dev/sda1 /mnt/SSD
[comicsong@comicsong fio]$ mount | grep sda
/dev/sda1 on /mnt/SSD type ext4 (rw,noatime,data=ordered)
  • テスト実施。
for TEST in read write readwrite randread randwrite randrw
  do for NUM in {1..5}
    do echo -n "${TEST}_${NUM} :"
    fio fio.ini -rw ${TEST} | tee -a /home/comicsong/fio/ext4_discard_off.log | grep "iops="
    /bin/rm -r /mnt/SSD/fio/tmp/*
  done
  echo "----------------------"
done

discard無効

read_1 :  read : io=9176.4MB, bw=104404KB/s, iops=26101, runt= 90002msec
read_2 :  read : io=8701.6MB, bw=99002KB/s, iops=24750, runt= 90002msec
read_3 :  read : io=10073MB, bw=114611KB/s, iops=28652, runt= 90002msec
read_4 :  read : io=8216.2MB, bw=93479KB/s, iops=23369, runt= 90002msec
read_5 :  read : io=9172.6MB, bw=104361KB/s, iops=26090, runt= 90001msec
----------------------
write_1 :  write: io=9446.6MB, bw=107478KB/s, iops=26869, runt= 90002msec
write_2 :  write: io=9433.1MB, bw=107325KB/s, iops=26831, runt= 90002msec
write_3 :  write: io=9355.2MB, bw=106439KB/s, iops=26609, runt= 90002msec
write_4 :  write: io=9488.5MB, bw=107956KB/s, iops=26988, runt= 90001msec
write_5 :  write: io=9464.3MB, bw=107679KB/s, iops=26919, runt= 90002msec
----------------------
readwrite_1 :  read : io=982896KB, bw=10919KB/s, iops=2729, runt= 90014msec
  write: io=984500KB, bw=10937KB/s, iops=2734, runt= 90014msec
readwrite_2 :  read : io=993764KB, bw=11041KB/s, iops=2760, runt= 90010msec
  write: io=995820KB, bw=11063KB/s, iops=2765, runt= 90010msec
readwrite_3 :  read : io=984244KB, bw=10934KB/s, iops=2733, runt= 90015msec
  write: io=985844KB, bw=10952KB/s, iops=2737, runt= 90015msec
readwrite_4 :  read : io=989096KB, bw=10989KB/s, iops=2747, runt= 90006msec
  write: io=990784KB, bw=11008KB/s, iops=2751, runt= 90006msec
readwrite_5 :  read : io=987420KB, bw=10969KB/s, iops=2742, runt= 90017msec
  write: io=989016KB, bw=10987KB/s, iops=2746, runt= 90017msec
----------------------
randread_1 :  read : io=10912MB, bw=124151KB/s, iops=31037, runt= 90001msec
randread_2 :  read : io=10932MB, bw=124380KB/s, iops=31094, runt= 90001msec
randread_3 :  read : io=10990MB, bw=125041KB/s, iops=31260, runt= 90001msec
randread_4 :  read : io=11005MB, bw=125209KB/s, iops=31302, runt= 90001msec
randread_5 :  read : io=11012MB, bw=125293KB/s, iops=31323, runt= 90001msec
----------------------
randwrite_1 :  write: io=8964.4MB, bw=101993KB/s, iops=25498, runt= 90001msec
randwrite_2 :  write: io=8371.5MB, bw=95101KB/s, iops=23775, runt= 90140msec
randwrite_3 :  write: io=8284.7MB, bw=94111KB/s, iops=23527, runt= 90143msec
randwrite_4 :  write: io=8442.8MB, bw=96050KB/s, iops=24012, runt= 90002msec
randwrite_5 :  write: io=8135.7MB, bw=92564KB/s, iops=23140, runt= 90002msec
----------------------
randrw_1 :  read : io=1019.1MB, bw=11603KB/s, iops=2900, runt= 90008msec
  write: io=1020.1MB, bw=11615KB/s, iops=2903, runt= 90008msec
randrw_2 :  read : io=1028.9MB, bw=11703KB/s, iops=2925, runt= 90020msec
  write: io=1029.1MB, bw=11716KB/s, iops=2928, runt= 90020msec
randrw_3 :  read : io=1020.7MB, bw=11612KB/s, iops=2903, runt= 90006msec
  write: io=1021.8MB, bw=11624KB/s, iops=2906, runt= 90006msec
randrw_4 :  read : io=1028.2MB, bw=11697KB/s, iops=2924, runt= 90008msec
  write: io=1029.2MB, bw=11708KB/s, iops=2926, runt= 90008msec
randrw_5 :  read : io=1015.9MB, bw=11546KB/s, iops=2886, runt= 90023msec
  write: io=1016.1MB, bw=11558KB/s, iops=2889, runt= 90023msec

まとめ

  • discard有効時での比較は目立って大きな差がない
  • 無効時はxfsが特にwrite関連で速い。write関連は xfs = discard有効ext4 > discard無効ext4
  • 比較をするときは条件をできる限りそろえよう