All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	Cedric.dewijs@eclipso.eu, linux-btrfs@vger.kernel.org
Subject: Re: Raid1 of a slow hdd and a fast(er) SSD, howto to prioritize the SSD?
Date: Wed, 6 Jan 2021 10:55:37 +0800	[thread overview]
Message-ID: <bd65383b-26cd-24ff-54b6-2f1c6a9a407a@oracle.com> (raw)
In-Reply-To: <3c670816-35b9-4bb7-b555-1778d61685c7@gmx.com>



>> ­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.

  parent reply	other threads:[~2021-01-06  2:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  6:39 Raid1 of a slow hdd and a fast(er) SSD, howto to prioritize the SSD?  
2021-01-05  6:53 ` Qu Wenruo
2021-01-05 18:19   `  
2021-01-07 22:11     ` Zygo Blaxell
2021-01-05 19:19   ` Stéphane Lesimple
2021-01-06  2:55   ` Anand Jain [this message]
2021-01-08  8:16 ` Andrea Gelmini
2021-01-08  8:36   `  
2021-01-08 14:00     ` Zygo Blaxell
2021-01-08 19:29     ` Andrea Gelmini
2021-01-09 21:40       ` Zygo Blaxell
2021-01-10  9:00         ` Andrea Gelmini
2021-01-16  1:04           ` Zygo Blaxell
2021-01-16 15:27             `  
2021-01-18  0:45               ` Zygo Blaxell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd65383b-26cd-24ff-54b6-2f1c6a9a407a@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=Cedric.dewijs@eclipso.eu \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.