BTRFS, mount options and virtual machines: an in-depth look

Written by Gionatan Danti on . Posted in Linux & Unix

User Rating:  / 13
PoorBest 

Fragmentation: still a big problem

BTRFS is well known for its fragmentation tendency, especially when used with the default CoW behavior. The following two graph show the magnitude of the problem. First, fragmentation was checked after the Windows 7 phase1 installation process: 

BTRFS fragmentation after install

 and then, after all test finished: 

BTRFS fragmentation after all tests

 In both cases, BTRFS show a very large number of fragments. If you use cache=writeback or disable CoW, fragments are a lot less, leading to large performance gains.

Remember that fragmentation is #1 enemy for mechanical drives: as seek latency are in average  4-10 ms long (and you had to add rotational delay also), a very fragmented filesystem is doomed to slow performance. Somewhat paradoxically, small random transfers are less affected by fragmentation, as their random nature implies many head seeks anyway: this is the reason why we saw BTRFS read performance to be very good. However, BTRFS slow random write speed seems to imply a lot of metadata overhead also.

Returning to the above data, using cache=writeback enable the host OS to coalesce multiple guest writes to a single disk write, leading to lower fragmentation. 

In a similar manner, disabling CoW enable BTRFS to do in-place rewrite, a very common operation for virtual disk images and database files. Enable  CoW and you force BTRFS to do a new allocation for each rewritten block, killing performance.

Comments   

 
#1 CSRedRat 2013-11-13 16:32
Btrfs is great!
 

You have no rights to post comments