­I have put a SSD and a slow laptop HDD in btrfs raid. This was a bad idea, my system does not feel responsive. When i load a program, dstat shows half of the program is loaded from the SSD, and the rest from the slow hard drive.

The drive speeds are evolving. NVME introduced lower latency than the
SSD. Mixing up drives amid production is unavoidable sometimes.



Btrfs uses pid to load balance read IIRC, thus it sucks in such workload.


PID is not good when drives are of mixed speeds. But it balances
with the block layer IO queuing and sorting and cache. So it provides
equally good read IO performance when all drives are of the same speed.

I was expecting btrfs to do almost all reads from the fast SSD, as both the data and the metadata is on that drive, so the slow hdd is only really needed when there's a bitflip on the SSD, and the data has to be reconstructed.

IIRC there will be some read policy feature to do that, but not yet
merged,

Yes. Patches are here [1]. These patches have dependent patches that are
merged in V5.11-rc1. Please give it a try. See below for which policy to
use.

and even merged, you still need to manually specify the
priority, as there is no way for btrfs to know which driver is faster
(except the non-rotational bit, which is not reliable at all).


 Hm. This is wrong.

 There are two types of read policies as of now.

 - Latency
 - Device

 Latency - For each read IO Latency policy dynamically picks the drive
 with the lowest latency based on its historic read IO wait.

  Set the policy sysfs:
  echo "latency" > /sys/fs/btrfs/$uuid/read_policy

 Device - is a kind of manual configuration, you can tell the read IO
 which device to read from when all the strips are healthy.

  Set it in the sysfs:
  First tell which Device is preferred for reading.
    echo 1 > /sys/fs/btrfs/$uuid/devinfo/$devid/read_preferred

  Set the policy:
  echo "device" > /sys/fs/btrfs/$uuid/read_policy

 The policy type round-robin is still experimental.

 Also, note that read policies are in memory only. You have to set it
 again (using sysfs) after the reboot/remount. I am open to feedback.


[1]
V2:
[PATCH v2 0/4] btrfs: read_policy types latency, device and round-robin


Thanks.

Reply via email to