kdave / btrfsmaintenance

Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected mountpoints or directories.
GNU General Public License v2.0
900 stars 79 forks source link

Question: Why different default musage/dusage defaults? #64

Closed billdenney closed 4 years ago

billdenney commented 5 years ago

First, thanks for these scripts! I'd cobbled something together that didn't work nearly as well.

Why do the default values for dusage and musage not match? I would have assumed that making them both the same would yield optimal balancing, but musage only goes to 30 while dusage goes to 50.

https://github.com/kdave/btrfsmaintenance/blob/cf421fcadbbad9665ce3d14cba7d673d9386346d/sysconfig.btrfsmaintenance#L53-L74

sten0 commented 5 years ago

@billdenney IIRC this is because 30 is the cut-point of diminishing returns for balancing metadata, where 50 is the cut-point for data.

kdave commented 5 years ago

The effects are different for data and metadata. Balancing metadata has much higher performance impact, the idea was that reclaiming block groups with more than 30% used is not worth the cost. Over time we've gathered some feedback that this might still be too high so the defaults will change in future release. As it stays configurable, you can still set any values you wish.

Balancing data copies lots of data as-is to a new location, and updates a few metadata pointers to the new data (eg. copy 512MiB data, update a megabyte-worth of metadata). Mostly seuqential IO. OTOH balancing metadata means rewriting a few hundred megabytes-worth of metadata of block pointers and other structures, typically not sequential updates, lots of seeking.

billdenney commented 5 years ago

Thanks for the explanation!

kdave commented 4 years ago

In version 0.5 the defaults have been reduced, the explanation is in the readme. Closing.