SSDのdiscardオプションの効能
SSDの実削除効率化を行うTrimコマンドの有効化をするdiscardオプションの効果を探る
HDDをほぼフルまで埋め、その後の削除時間/削除後の再ベンチマーク結果を比較する
- 利用前の空き容量
[comicsong@comicsong fio]$ df -H /mnt/mint/ ファイルシス サイズ 使用 残り 使用% マウント位置 /dev/sda1 248G 120G 116G 51% /mnt/mint
- Trimコマンドをより体感するためには容量埋めたほうがよいのでJOBファイルはsizeのみ変更する
- また今日は時間に余裕があるのでテストのブレを少なくするためruntimeを90秒とした
size=12g runtime=90
12GB*8プロセスで96GBの容量を埋める
- その他の環境は前回と同じ。なおスケジューラはnoop e6zout.hatenablog.jp
テストコマンド
for NUM in {1..5} do fio iotest.ini -rw randwrite | awk '$4 ~ /iops=/ {print $4}' time /bin/rm -rf tmp/* done
- discard有効時の結果
[comicsong@comicsong fio]$ mount | grep sda | grep -c discard 1
iops=26049, real 0m1.105s iops=28980, real 0m1.052s iops=26416, real 0m0.940s iops=27914, real 0m1.721s iops=27357, real 0m0.951s
- アンマウントして無効化
[comicsong@comicsong fio]$ cd ~ [comicsong@comicsong ~]$ sudo umount /mnt/mint/ [comicsong@comicsong ~]$ sudo mount LABEL="MINT" -oseclabel,noatime,data=ordered /mnt/mint/ [comicsong@comicsong ~]$ mount | grep sda | grep -c discard 0 [comicsong@comicsong ~]$ mount|grep mint /dev/sda1 on /mnt/mint type ext4 (rw,noatime,data=ordered)
- discard無効時の結果
iops=28899, real 0m1.361s iops=24037, real 0m1.694s iops=26168, real 0m0.867s iops=26445, real 0m0.892s iops=26790, real 0m1.658s
- まとめ
- trimによりrm実施時のデータ削除が適切に行われてその後のwrite時に1000~2000IOPS程度の差が出た
- 低利用率時の差は別途見る必要があるがディスク容量を大きく使う場合はdiscardオプションは有効
- 無効化初回のスコアがいいのはtrim自体は有効時の最後のrmで実施していたからと予想