0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WSL2 で Windowsマウントファイルのディスクベンチマーク

Posted at

WSL2(Ubuntu) で Windowsファイルのマウントポイントへのアクセスが遅いので、どれくらい遅いのかディスクベンチマークツール fio(Flexible I/O Tester)を使って計測してみました。

fio(Flexible I/O Tester)とは?

fio は、ストレージデバイス(HDD、SSD、NVMeなど)の性能評価や負荷テストを行うためのツールです。

項目 内容
名称 fio(Flexible I/O tester)
開発元 Jens Axboe(Linuxカーネル開発者)
主な用途 ディスクI/Oのベンチマーク、ストレージの性能測定、I/O負荷生成
対応OS Linux(Ubuntu, CentOSなど)、FreeBSD、Windows など
特徴 高度なカスタマイズ、スクリプト対応、複数スレッド・プロセス対応

Ubuntuへのインストール

aptでインストール

$ sudo apt update
$ sudo apt install fio

最新版をビルド(必要な場合)

$ git clone https://github.com/axboe/fio.git
$ cd fio
$ make
$ sudo make install

基本的な使い方

1. シーケンシャルリードテスト

$ fio --name=read_test --filename=testfile --size=1G --bs=1M --rw=read --ioengine=libaio --direct=1

パラメータ 内容
--name=read_test ジョブの名前
--filename=testfile 対象ファイル名(存在しなければ自動生成)
--size=1G テストサイズ(1GB)
--bs=1M ブロックサイズ(1MB)
--rw=read 読み込みモード
--ioengine=libaio 非同期I/Oエンジン
--direct=1 バッファリングを無効化(OSキャッシュの影響を除外)

2. ランダムライトテスト

$ fio --name=randwrite --filename=testfile --size=1G --bs=4k --rw=randwrite --ioengine=libaio --direct=1

--rw=randwrite:ランダムライト
--bs=4k:小さいブロックサイズ(実運用に近い)

3. 読み書き混合(70% read / 30% write)

$ fio --name=mixed --filename=testfile --size=1G --bs=4k --rw=randrw --rwmixread=70 --ioengine=libaio --direct=1

--rw=randrw:ランダム読み書き混合
--rwmixread=70:リード70%、ライト30%

4. 同時スレッドを増やして負荷テスト

$ fio --name=threaded --filename=testfile --size=1G --bs=4k --rw=randwrite --ioengine=libaio --numjobs=4 --direct=1

--numjobs=4:4スレッドで同時に処理

出力例(抜粋)

read: IOPS=4560, BW=17.8MiB/s, Latency=0.25ms
write: IOPS=3800, BW=14.8MiB/s, Latency=0.35ms
項目 説明
IOPS 1秒あたりのI/O回数(ランダムアクセス性能の指標)
BW 帯域幅(MB/s)=転送速度
Latency 平均I/Oレイテンシ(応答時間)

テストファイルの注意点

ファイルシステム上に作られたテストファイルを使う
キャッシュの影響を避けたいなら --direct=1
テスト後は削除を忘れずに:

$ rm testfile

スクリプトによる実行(fio jobファイル)

複数条件のテストを .fio ファイルに定義して実行できます:

# test.fio
[seq_read]
rw=read
bs=1M
size=512M
filename=testfile
direct=1
ioengine=libaio
$ fio test.fio

計測結果

job ファイル

[global]
ioengine=libaio
direct=1
gtod_reduce=1
numjobs=1
time_based=1
runtime=60
ramp_time=5
randrepeat=0
norandommap=1
group_reporting=1
filename=/tmp/fiotest

[write]
stonewall
bs=4k
size=512k
rw=write
iodepth=64

[read]
stonewall
bs=4k
size=512k
rw=read
iodepth=64

コマンドライン引数

$ fio \
--name=write \
--ioengine=libaio \
--direct=1 \
--gtod_reduce=1 \
--numjobs=1 \
--time_based=1 \
--runtime=60 \
--ramp_time=5 \
--randrepeat=0 \
--norandommap=1 \
--group_reporting=1 \
--filename=/tmp/fiotest \
--rw=write \
--bs=4k \
--size=512k \
--iodepth=64 \
--stonewall \
--name=read \
--rw=read \
--bs=4k \
--size=512k \
--iodepth=64

補足:複数ジョブを1回で実行する構文

--name=... を切り替えることで、複数の I/O テスト(write と read)を1つの fio コマンドで順に実行可能です。stonewall によって、write 完了後に read を開始することが保証されます。

実行例(完全コマンド)

$ fio \
--ioengine=libaio \
--direct=1 \
--gtod_reduce=1 \
--numjobs=1 \
--time_based=1 \
--runtime=60 \
--ramp_time=5 \
--randrepeat=0 \
--norandommap=1 \
--group_reporting=1 \
--filename=/tmp/fiotest \
--name=write \
--rw=write \
--bs=4k \
--size=512k \
--iodepth=64 \
--stonewall \
--name=read \
--rw=read \
--bs=4k \
--size=512k \
--iodepth=64

/mnt/c/ のファイル

write: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
read: (g=1): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.36
Starting 2 processes
write: Laying out IO file (1 file / 0MiB)
read: Laying out IO file (1 file / 0MiB)
Jobs: 1 (f=1): [_(1),R(1)][100.0%][r=20.6MiB/s][r=5268 IOPS][eta 00m:00s]
write: (groupid=0, jobs=1): err= 0: pid=9566: Mon Jul 14 09:55:48 2025
  write: IOPS=2606, BW=10.2MiB/s (10.7MB/s)(611MiB/60010msec); 0 zone resets
   bw (  KiB/s): min=   48, max=23656, per=99.99%, avg=10429.14, stdev=7517.02, samples=120
   iops        : min=   12, max= 5914, avg=2607.22, stdev=1879.23, samples=120
  cpu          : usr=1.05%, sys=2.56%, ctx=156437, majf=0, minf=36
  IO depths    : 1=0.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=100.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
     issued rwts: total=0,156417,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=64
read: (groupid=1, jobs=1): err= 0: pid=9568: Mon Jul 14 09:55:48 2025
  read: IOPS=3019, BW=11.8MiB/s (12.4MB/s)(708MiB/60007msec)
   bw (  KiB/s): min=   24, max=29592, per=100.00%, avg=12082.27, stdev=9100.20, samples=120
   iops        : min=    6, max= 7398, avg=3020.53, stdev=2275.02, samples=120
  cpu          : usr=0.96%, sys=2.77%, ctx=181224, majf=0, minf=37
  IO depths    : 1=0.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=100.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
     issued rwts: total=181192,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=64

Run status group 0 (all jobs):
  WRITE: bw=10.2MiB/s (10.7MB/s), 10.2MiB/s-10.2MiB/s (10.7MB/s-10.7MB/s), io=611MiB (641MB), run=60010-60010msec

Run status group 1 (all jobs):
   READ: bw=11.8MiB/s (12.4MB/s), 11.8MiB/s-11.8MiB/s (12.4MB/s-12.4MB/s), io=708MiB (742MB), run=60007-60007msec

/home 以下のファイル

write: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
read: (g=1): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.36
Starting 2 processes
write: Laying out IO file (1 file / 0MiB)
Jobs: 1 (f=1): [_(1),R(1)][100.0%][r=73.5MiB/s][r=18.8k IOPS][eta 00m:00s]
write: (groupid=0, jobs=1): err= 0: pid=9523: Mon Jul 14 09:52:41 2025
  write: IOPS=16.0k, BW=62.6MiB/s (65.6MB/s)(3754MiB/60006msec); 0 zone resets
   bw (  KiB/s): min= 7975, max=155406, per=99.99%, avg=64063.40, stdev=36604.08, samples=119
   iops        : min= 1993, max=38851, avg=16015.69, stdev=9151.02, samples=119
  cpu          : usr=5.59%, sys=28.34%, ctx=290090, majf=0, minf=36
  IO depths    : 1=0.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=100.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
     issued rwts: total=0,961086,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=64
read: (groupid=1, jobs=1): err= 0: pid=9524: Mon Jul 14 09:52:41 2025
  read: IOPS=21.4k, BW=83.6MiB/s (87.6MB/s)(5015MiB/60004msec)
   bw (  KiB/s): min=60272, max=96368, per=100.00%, avg=85641.61, stdev=4932.81, samples=120
   iops        : min=15068, max=24092, avg=21410.25, stdev=1233.21, samples=120
  cpu          : usr=6.29%, sys=23.41%, ctx=472276, majf=0, minf=37
  IO depths    : 1=0.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=100.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
     issued rwts: total=1283654,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=64

Run status group 0 (all jobs):
  WRITE: bw=62.6MiB/s (65.6MB/s), 62.6MiB/s-62.6MiB/s (65.6MB/s-65.6MB/s), io=3754MiB (3937MB), run=60006-60006msec

Run status group 1 (all jobs):
   READ: bw=83.6MiB/s (87.6MB/s), 83.6MiB/s-83.6MiB/s (87.6MB/s-87.6MB/s), io=5015MiB (5258MB), run=60004-60004msec

Disk stats (read/write):
  sdc: ios=1425459/1068271, sectors=11403672/8546536, merge=0/40, ticks=3347209/3680373, in_queue=7027821, util=99.16%

まとめ

Widowsファイルシステムをマウントしたファイルアクセスはかなり遅くなりますので、Linux側にコピーしてアクセスする方がよさそうです。

file write read
on Windows 10.2MiB/s (10.7MB/s) 11.8MiB/s (12.4MB/s)
on Linux 62.6MiB/s (65.6MB/s) 83.6MiB/s (87.6MB/s)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?