Very slow BTRFS performance?

I have just installed Rockstor and am moving my files from NTFS into a fresh BTRFS array. However, writing into the BTRFS array is exteremely slow right from the start. The speeds I’m seeing are:

Writing into a single btrfs disk: ~4MB/s
Writing into a two-disk array (single mode): ~4MB/s
Writing into the same two-disk array (raid0 for data, raid1 for metadata): ~8MB/s
Writing into another NTFS disk: ~50MB/s

My motherboard is Asus E35M1-I (AMD E-350 CPU) with 8GB of ram, and Rockstor is installed on two USB sticks connected to USB2.0 in raid1.

I’m also experiencing a lot of delays both the CLI and the Web UI when writing files to the BTRFS array. In the Web UI my Average CPU Usage is close to 100%, but almost all of which (90%+) is wait time according to top.

Could someone help me find out what’s the problem with my setup?

Just to confirm the Pools/Shares did get correctly created and you are writing to the HDD’s and not the USB sticks right?

Also I think rockstor needs to write data to the root volume fairly regularly, I wonder if the USB sticks are slowing you down.

Yes, I have written ~500GB to to the array so I’m pretty sure it’s written to the right place ;). And yes, the USB sticks did make installation pretty slow, but they don’t slow down my NTFS disks.

BTW, I have looked into dmesg and didn’t find anything there either.

Whats your btrfs mount options? May enable ‘noatime’ , ‘thread_pool’ and see whether that improves the performance? Not sure about the results, but worth a try.

1 Like

Thanks. I’m using the default with relatime and (I believe) thread_pool=4. Looks like using noatime has no effect.

I forgot to mention that I’m using 2.5" disks, so it might just be that my disks are slow. But is sequential write under BTRFS supposed to be this bad? The read speeds for the same array are:

Sequential read by dd a large file into /dev/null: ~30MB/s
BTRFS scrub: ~50MB/s

those numbers look really bad, even this little cpu should handle >200MB/s, the disks should give >100MB/s total, did you test if the same speeds apply to single disk tests with other fs? eg format as ext4 and test with dd

if yes it might be related to some driver for the controller, if not its btrfs related

I agree with felixbrucker, you can confirm whether its related to FS or driver by testing with ext4.

Writing into a single btrfs disk: ~4MB/s
I get >100MB/s for both read and write on a laptop (centos7) with 8gb ram on a AMD’s FX-7500 APU (similar to intel i3)

Thanks for all the suggestions! Like @felixbrucker I think the CPU should be fast enough, as it’s a common enough choice among FreeNAS users.

I suspect my problem is hardware related though, as I got a lot of IO errors after adding another two disks into the array. Maybe it’s a dying controller/bad PSU/bad cables. I’ve switched out the PSU and at least things seem to be more stable now. It does seem that laptop drives vary greatly in speed though; among my four disks raw sequential read speed ranges from 30MB/s to 100MB/s, and the slowest one is a brand new 2TB WD green. Will do more tests once the current balancing finishes.