kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
528 stars 238 forks source link

Clarify read performance note #781

Open calumapplepie opened 2 months ago

calumapplepie commented 2 months ago

The btrfs readthedocs, which is sourced from this repository, says the following at this link:

"The simple redundancy RAID levels utilize different mirrors in a way that does not achieve the maximum performance. The logic can be improved so the reads will spread over the mirrors evenly or based on device congestion."

Where is this logic? What can be improved about it? Is this suggesting that, in current kernels, reads on a RAID1 filesystem go directly to the same disk, every time, rather than being distributed between the 2? Is this statement out-of-date?

Zygo commented 2 months ago

See find_live_mirror in fs/btrfs/volumes.c. There is a read policy framework which would allow defining better read policies, but to date only one has been implemented: the PID policy, which assigns threads to devices based on PID.

You can read about an earlier attempt from 2021 here and here. The alternative policies were dropped due to various issues.