linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] raid1 balancing methods
@ 2024-09-27  9:55 Anand Jain
  2024-09-27  9:55 ` [PATCH 1/3] btrfs: introduce RAID1 round-robin read balancing Anand Jain
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Anand Jain @ 2024-09-27  9:55 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, waxhead

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-10-11  1:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27  9:55 [PATCH 0/3] raid1 balancing methods Anand Jain
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).