From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.com, waxhead@dirtcellar.net
Subject: [PATCH 0/3] raid1 balancing methods
Date: Fri, 27 Sep 2024 17:55:19 +0800 [thread overview]
Message-ID: <cover.1727368214.git.anand.jain@oracle.com> (raw)
The RAID1-balancing methods helps distribute read I/O across devices, and
this patch introduces three balancing methods: rotation, latency, and
devid. These methods are enabled under the `CONFIG_BTRFS_DEBUG` config
option and are on top of the previously added
`/sys/fs/btrfs/<UUID>/read_policy` interface to configure the desired
RAID1 read balancing method.
I've tested these patches using fio and filesystem defragmentation
workloads on a two-device RAID1 setup (with both data and metadata
mirrored across identical devices). I tracked device read counts by
extracting stats from `/sys/devices/<..>/stat` for each device. Below is
a summary of the results, with each result the average of three
iterations.
A typical generic random rw workload:
$ fio --filename=/btrfs/foo --size=10Gi --direct=1 --rw=randrw --bs=4k \
--ioengine=libaio --iodepth=256 --runtime=120 --numjobs=4 --time_based \
--group_reporting --name=iops-test-job --eta-newline=1
| | | | Read I/O count |
| | Read | Write | devid1 | devid2 |
|---------|------------|------------|--------|--------|
| pid | 29.4MiB/s | 29.5MiB/s | 456548 | 447975 |
| rotation| 29.3MiB/s | 29.3MiB/s | 450105 | 450055 |
| latency | 21.9MiB/s | 21.9MiB/s | 672387 | 0 |
| devid:1 | 22.0MiB/s | 22.0MiB/s | 674788 | 0 |
Defragmentation with compression workload:
$ xfs_io -f -d -c 'pwrite -S 0xab 0 1G' /btrfs/foo
$ sync
$ echo 3 > /proc/sys/vm/drop_caches
$ btrfs filesystem defrag -f -c /btrfs/foo
| | Time | Read I/O Count |
| | Real | devid1 | devid2 |
|---------|-------|--------|--------|
| pid | 21.61s| 3810 | 0 |
| rotation| 11.55s| 1905 | 1905 |
| latency | 20.99s| 0 | 3810 |
| devid:2 | 21.41s| 0 | 3810 |
. The PID-based balancing method works well for the generic random rw fio
workload.
. The rotation method is ideal when you want to keep both devices active,
and it boosts performance in sequential defragmentation scenarios.
. The latency-based method work well when we have mixed device types or
when one device experiences intermittent I/O failures the latency
increases and it automatically picks the other device for further Read
IOs.
. The devid method is a more hands-on approach, useful for diagnosing and
testing RAID1 mirror synchronizations.
Anand Jain (3):
btrfs: introduce RAID1 round-robin read balancing
btrfs: use the path with the lowest latency for RAID1 reads
btrfs: add RAID1 preferred read device feature
fs/btrfs/sysfs.c | 94 ++++++++++++++++++++++++++++++-------
fs/btrfs/volumes.c | 113 +++++++++++++++++++++++++++++++++++++++++++++
fs/btrfs/volumes.h | 14 ++++++
3 files changed, 205 insertions(+), 16 deletions(-)
--
2.46.0
next reply other threads:[~2024-09-27 9:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 9:55 Anand Jain [this message]
2024-09-27 9:55 ` [PATCH 1/3] btrfs: introduce RAID1 round-robin read balancing Anand Jain
2024-09-27 10:10 ` Qu Wenruo
2024-10-11 1:21 ` Anand Jain
2024-09-27 9:55 ` [PATCH 2/3] btrfs: use the path with the lowest latency for RAID1 reads Anand Jain
2024-09-27 10:25 ` Qu Wenruo
2024-10-11 1:21 ` Anand Jain
2024-09-27 9:55 ` [PATCH 3/3] btrfs: add RAID1 preferred read device feature Anand Jain
2024-10-04 10:44 ` [PATCH 0/3] raid1 balancing methods Yuwei Han
2024-10-11 1:20 ` Anand Jain
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=cover.1727368214.git.anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=waxhead@dirtcellar.net \
/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.