---
# System prepended metadata

title: Btrfs vs F2FS ベンチマーク

---

Btrfs vs F2FS ベンチマーク
===

## もともとのシーケンシャルリード性能

```
/dev/second/second:
 Timing cached reads:   20864 MB in  1.99 seconds = 10490.45 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
 Timing buffered disk reads: 4636 MB in  3.00 seconds = 1544.95 MB/sec
```

## 今回使ったfioのjobfile

```
[global]
filename=/mnt/fiotest
randrepeat=1
ioengine=libaio
bs=4k
ba=4k
size=4G
gtod_reduce=1
norandommap
iodepth=64

[bench]
rw=randwrite
stonewall
```

参考: https://syucream.hatenablog.jp/entry/2013/12/19/221559

## Btrfs + zstd

```
sudo mkfs.btrfs /dev/second/second
sudo mount /dev/second/second -o rw,relatime,ssd_spread,compress=zstd,space_cache /mnt
```

```
bench: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.23
Starting 1 process
bench: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [w(1)][100.0%][eta 00m:00s]
bench: (groupid=0, jobs=1): err= 0: pid=1715088: Tue Oct 20 18:37:01 2020
  write: IOPS=71.2k, BW=278MiB/s (292MB/s)(4096MiB/14734msec); 0 zone resets
   bw (  KiB/s): min=45704, max=938192, per=100.00%, avg=303974.81, stdev=213490.82, samples=27
   iops        : min=11426, max=234548, avg=75993.78, stdev=53372.68, samples=27
  cpu          : usr=8.14%, sys=45.17%, ctx=121088, majf=0, minf=5
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=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,1048576,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=278MiB/s (292MB/s), 278MiB/s-278MiB/s (292MB/s-292MB/s), io=4096MiB (4295MB), run=14734-14734msec
```

## F2FS

```
sudo mkfs.f2fs /dev/second/second -f
sudo mount /dev/second/second -o rw,relatime /mnt
```

```
bench: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.23
Starting 1 process
bench: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [w(1)][-.-%][w=1146MiB/s][w=293k IOPS][eta 00m:00s]
bench: (groupid=0, jobs=1): err= 0: pid=1752006: Tue Oct 20 18:40:06 2020
  write: IOPS=290k, BW=1133MiB/s (1188MB/s)(4096MiB/3616msec); 0 zone resets
   bw (  MiB/s): min=  866, max= 1233, per=99.68%, avg=1129.17, stdev=147.13, samples=7
   iops        : min=221910, max=315816, avg=289067.14, stdev=37664.51, samples=7
  cpu          : usr=23.82%, sys=68.63%, ctx=703, majf=0, minf=6
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=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,1048576,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=1133MiB/s (1188MB/s), 1133MiB/s-1133MiB/s (1188MB/s-1188MB/s), io=4096MiB (4295MB), run=3616-3616msec

Disk stats (read/write):
    dm-2: ios=0/2332, merge=0/0, ticks=0/25993, in_queue=25992, util=44.67%, aggrios=0/7789, aggrmerge=0/11, aggrticks=0/92840, aggrin_queue=92841, aggrutil=47.02%
  nvme0n1: ios=0/7789, merge=0/11, ticks=0/92840, in_queue=92841, util=47.02%
```

## F2FS + zstd

```
sudo mkfs.f2fs /dev/second/second -O extra_attr,compression -f
sudo mount /dev/second/second -o rw,relatime,compress_algorithm=zstd /mnt
```

```
bench: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.23
Starting 1 process
bench: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [w(1)][-.-%][w=980MiB/s][w=251k IOPS][eta 00m:00s]
bench: (groupid=0, jobs=1): err= 0: pid=1802915: Tue Oct 20 18:44:28 2020
  write: IOPS=269k, BW=1053MiB/s (1104MB/s)(4096MiB/3891msec); 0 zone resets
   bw (  MiB/s): min=  909, max= 1284, per=100.00%, avg=1064.61, stdev=127.18, samples=7
   iops        : min=232766, max=328892, avg=272540.00, stdev=32557.61, samples=7
  cpu          : usr=21.70%, sys=63.57%, ctx=965, majf=0, minf=7
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=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,1048576,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=1053MiB/s (1104MB/s), 1053MiB/s-1053MiB/s (1104MB/s-1104MB/s), io=4096MiB (4295MB), run=3891-3891msec

Disk stats (read/write):
    dm-2: ios=0/2583, merge=0/0, ticks=0/40363, in_queue=40363, util=43.55%, aggrios=0/7692, aggrmerge=0/6, aggrticks=0/118840, aggrin_queue=118840, aggrutil=42.63%
  nvme0n1: ios=0/7692, merge=0/6, ticks=0/118840, in_queue=118840, util=42.63%
```

## F2FS + lzo

```
sudo mount /dev/second/second -o rw,relatime,compress_algorithm=lzo /mnt
```

```
bench: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.23
Starting 1 process
bench: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [w(1)][100.0%][w=927MiB/s][w=237k IOPS][eta 00m:00s]
bench: (groupid=0, jobs=1): err= 0: pid=1832153: Tue Oct 20 18:46:50 2020
  write: IOPS=240k, BW=938MiB/s (983MB/s)(4096MiB/4369msec); 0 zone resets
   bw (  KiB/s): min=855192, max=1286056, per=100.00%, avg=985448.00, stdev=141846.34, samples=8
   iops        : min=213798, max=321514, avg=246362.00, stdev=35461.58, samples=8
  cpu          : usr=21.59%, sys=62.20%, ctx=1089, majf=0, minf=6
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=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,1048576,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=938MiB/s (983MB/s), 938MiB/s-938MiB/s (983MB/s-983MB/s), io=4096MiB (4295MB), run=4369-4369msec

Disk stats (read/write):
    dm-2: ios=0/2529, merge=0/0, ticks=0/38906, in_queue=38906, util=40.19%, aggrios=0/8128, aggrmerge=0/5, aggrticks=0/130612, aggrin_queue=130612, aggrutil=41.60%
  nvme0n1: ios=0/8128, merge=0/5, ticks=0/130612, in_queue=130612, util=41.60%
```