Skip to content

Instantly share code, notes, and snippets.

@nay-kang
Last active July 1, 2025 09:49
Show Gist options
  • Select an option

  • Save nay-kang/d5be1c1f5ea18a927f48defa1609f3a3 to your computer and use it in GitHub Desktop.

Select an option

Save nay-kang/d5be1c1f5ea18a927f48defa1609f3a3 to your computer and use it in GitHub Desktop.
btrfs filesystem performance issue

recently I facing some problem with btrfs.sometime when I trigger right click on btrfs files or just browse folders.I can notice more than 1 second hangup. in windows some action could hang up too.
I using scrub,defragment,check but it does not help anything.
using fio --filename=./test_file.delete --size=20GB --direct=1 --rw=randrw --bs=4k --ioengine=libaio --iodepth=256 --runtime=120 --numjobs=4 --time_based --group_reporting --name=job_name --eta-newline=1to benchmark. result is

job_name: (groupid=0, jobs=4): err= 0: pid=7334: Tue Jul  1 10:16:35 2025
  read: IOPS=25.8k, BW=101MiB/s (105MB/s)(11.8GiB/120001msec)
    slat (usec): min=6, max=8608, avg=62.11, stdev=72.59
    clat (usec): min=95, max=89745, avg=19831.73, stdev=4192.86
     lat (usec): min=118, max=89831, avg=19893.84, stdev=4203.43
    clat percentiles (usec):
     |  1.00th=[12518],  5.00th=[14746], 10.00th=[15533], 20.00th=[16319],
     | 30.00th=[16909], 40.00th=[17695], 50.00th=[18482], 60.00th=[19792],
     | 70.00th=[22676], 80.00th=[24511], 90.00th=[25822], 95.00th=[26608],
     | 99.00th=[28443], 99.50th=[29230], 99.90th=[36439], 99.95th=[43779],
     | 99.99th=[55313]
   bw (  KiB/s): min=77328, max=137896, per=99.95%, avg=102962.74, stdev=4654.56, samples=956
   iops        : min=19332, max=34474, avg=25740.69, stdev=1163.64, samples=956
  write: IOPS=25.7k, BW=101MiB/s (105MB/s)(11.8GiB/120001msec); 0 zone resets
    slat (usec): min=10, max=9840, avg=81.21, stdev=88.85
    clat (usec): min=21, max=88691, avg=19783.75, stdev=4208.11
     lat (usec): min=55, max=88721, avg=19864.96, stdev=4225.49
    clat percentiles (usec):
     |  1.00th=[12518],  5.00th=[14746], 10.00th=[15401], 20.00th=[16319],
     | 30.00th=[16909], 40.00th=[17695], 50.00th=[18482], 60.00th=[19530],
     | 70.00th=[22676], 80.00th=[24511], 90.00th=[25822], 95.00th=[26608],
     | 99.00th=[28443], 99.50th=[29230], 99.90th=[36439], 99.95th=[43254],
     | 99.99th=[54264]
   bw (  KiB/s): min=77792, max=136864, per=99.95%, avg=102918.43, stdev=4666.49, samples=956
   iops        : min=19448, max=34216, avg=25729.61, stdev=1166.62, samples=956
  lat (usec)   : 50=0.01%, 100=0.01%, 250=0.01%, 500=0.01%, 750=0.01%
  lat (usec)   : 1000=0.01%
  lat (msec)   : 2=0.01%, 4=0.06%, 10=0.36%, 20=61.11%, 50=38.44%
  lat (msec)   : 100=0.02%
  cpu          : usr=3.15%, sys=41.53%, ctx=6232316, majf=0, minf=53
  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.0%, >=64=0.1%
     issued rwts: total=3090485,3088985,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=256

Run status group 0 (all jobs):
   READ: bw=101MiB/s (105MB/s), 101MiB/s-101MiB/s (105MB/s-105MB/s), io=11.8GiB (12.7GB), run=120001-120001msec
  WRITE: bw=101MiB/s (105MB/s), 101MiB/s-101MiB/s (105MB/s-105MB/s), io=11.8GiB (12.7GB), run=120001-120001msec

I decide to switch back to NTFS.beaware mount NTFS with ntfs3 not ntfs-3g. the benchmark result is

job_name: (groupid=0, jobs=4): err= 0: pid=3221: Tue Jul  1 12:52:54 2025
  read: IOPS=47.3k, BW=185MiB/s (194MB/s)(21.7GiB/120012msec)
    slat (usec): min=2, max=1436, avg= 6.24, stdev= 2.77
    clat (usec): min=852, max=30853, avg=11278.40, stdev=3521.93
     lat (usec): min=860, max=30865, avg=11284.64, stdev=3521.92
    clat percentiles (usec):
     |  1.00th=[ 2376],  5.00th=[ 3720], 10.00th=[ 5735], 20.00th=[ 9110],
     | 30.00th=[10683], 40.00th=[11207], 50.00th=[11731], 60.00th=[12256],
     | 70.00th=[12911], 80.00th=[13698], 90.00th=[14877], 95.00th=[16188],
     | 99.00th=[19530], 99.50th=[21103], 99.90th=[23987], 99.95th=[25035],
     | 99.99th=[26870]
   bw (  KiB/s): min=163520, max=215224, per=100.00%, avg=189336.42, stdev=2275.08, samples=956
   iops        : min=40880, max=53806, avg=47334.12, stdev=568.77, samples=956
  write: IOPS=47.3k, BW=185MiB/s (194MB/s)(21.6GiB/120012msec); 0 zone resets
    slat (usec): min=2, max=1724, avg= 6.52, stdev= 2.88
    clat (usec): min=96, max=29733, avg=10352.06, stdev=3518.54
     lat (usec): min=108, max=29740, avg=10358.58, stdev=3518.53
    clat percentiles (usec):
     |  1.00th=[ 1434],  5.00th=[ 2802], 10.00th=[ 4817], 20.00th=[ 8160],
     | 30.00th=[ 9765], 40.00th=[10290], 50.00th=[10814], 60.00th=[11338],
     | 70.00th=[11994], 80.00th=[12780], 90.00th=[13829], 95.00th=[15270],
     | 99.00th=[18744], 99.50th=[20055], 99.90th=[22938], 99.95th=[23987],
     | 99.99th=[26084]
   bw (  KiB/s): min=167272, max=214336, per=100.00%, avg=189229.66, stdev=2214.46, samples=956
   iops        : min=41818, max=53584, avg=47307.41, stdev=553.62, samples=956
  lat (usec)   : 100=0.01%, 250=0.01%, 500=0.01%, 750=0.04%, 1000=0.11%
  lat (msec)   : 2=1.40%, 4=5.32%, 10=21.67%, 20=70.79%, 50=0.67%
  cpu          : usr=3.40%, sys=27.60%, ctx=2099931, majf=0, minf=52
  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.0%, >=64=0.1%
     issued rwts: total=5677730,5674752,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=256

Run status group 0 (all jobs):
   READ: bw=185MiB/s (194MB/s), 185MiB/s-185MiB/s (194MB/s-194MB/s), io=21.7GiB (23.3GB), run=120012-120012msec
  WRITE: bw=185MiB/s (194MB/s), 185MiB/s-185MiB/s (194MB/s-194MB/s), io=21.6GiB (23.2GB), run=120012-120012msec

Disk stats (read/write):
  nvme1n1: ios=5675937/5672927, sectors=45407496/45383416, merge=0/0, ticks=63796468/58359004, in_queue=122155471, util=49.90%

this is to two times faster.
and my usage is storing documents and steam games in the btrfs storage.the storage can mount either windows and linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment