public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] bcache: reduce front IO latency during GC
@ 2025-04-14 22:44 Robert Pang
  2025-04-14 22:44 ` [PATCH 1/1] bcache: process fewer btree nodes in incremental GC cycles Robert Pang
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Robert Pang @ 2025-04-14 22:44 UTC (permalink / raw)
  To: Coly Li, Kent Overstreet, linux-bcache; +Cc: Robert Pang, Mingzhe Zou

In performance benchmarks on disks with bcache using the Linux 6.6 kernel, we
observe noticeable IO latency increase during btree garbage collection. The
increase ranges from high tens to hundreds of milliseconds, depending on the
size of the cache device. Further investigation reveals that it is the same
issue reported in [1], where the large number of nodes processed in each
incremental GC cycle causes the front IO latency.

Building upon the approach suggested in [1], this patch decomposes the
incremental GC process into more but smaller cycles. In contrast to [1], this
implementation adopts a simpler strategy by setting a lower limit of 10 nodes
per cycle to reduce front IO delay and introducing a fixed 10ms sleep per cycle
when front IO is in progress. Furthermore, when garbage collection statistics
are available, the number of nodes processed per cycle is dynamically rescaled
based on the average GC frequency to ensure GC completes well within the next
subsequent scheduled interval.

Testing with a 750GB NVMe cache and 256KB bucket size using the following fio
configuration demonstrates that our patch reduces front IO latency during GC
without significantly increasing GC duration.

ioengine=libaio
direct=1
bs=4k
size=900G
iodepth=10
readwrite=randwrite
log_avg_msec=10

Before:

time-ms,latency-ns,,,

12170, 285016, 1, 0, 0
12183, 296581, 1, 0, 0
12207, 6542725, 1, 0, 0
12242, 24483604, 1, 0, 0
12250, 1895628, 1, 0, 0
12260, 284854, 1, 0, 0
12270, 275513, 1, 0, 0

/sys/block/bcache0/bcache/cache/internal/btree_gc_average_duration_ms:2880
/sys/block/bcache0/bcache/cache/internal/btree_gc_average_frequency_sec:133
/sys/block/bcache0/bcache/cache/internal/btree_gc_last_sec:121
/sys/block/bcache0/bcache/cache/internal/btree_gc_max_duration_ms:3456

After:

12690, 378494, 1, 0, 0
12700, 413934, 1, 0, 0
12710, 661217, 1, 0, 0
12727, 354510, 1, 0, 0
12730, 1100768, 1, 0, 0
12742, 382484, 1, 0, 0
12750, 532679, 1, 0, 0
12760, 572758, 1, 0, 0
12773, 283416, 1, 0, 0

/sys/block/bcache0/bcache/cache/internal/btree_gc_average_duration_ms:3619
/sys/block/bcache0/bcache/cache/internal/btree_gc_average_frequency_sec:58
/sys/block/bcache0/bcache/cache/internal/btree_gc_last_sec:23
/sys/block/bcache0/bcache/cache/internal/btree_gc_max_duration_ms:3866

[1] https://lore.kernel.org/all/20220511073903.13568-1-mingzhe.zou@easystack.cn/

Robert Pang (1):
  bcache: process fewer btree nodes in incremental GC cycles

 drivers/md/bcache/btree.c | 38 +++++++++++++++++---------------------
 drivers/md/bcache/util.h  |  3 +++
 2 files changed, 20 insertions(+), 21 deletions(-)

-- 
2.49.0.604.gff1f9ca942-goog


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

end of thread, other threads:[~2025-07-18  6:18 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 22:44 [PATCH 0/1] bcache: reduce front IO latency during GC Robert Pang
2025-04-14 22:44 ` [PATCH 1/1] bcache: process fewer btree nodes in incremental GC cycles Robert Pang
2025-04-15  2:08   ` Coly Li
2025-04-15 17:25     ` Robert Pang
2025-04-16  9:44       ` Coly Li
2025-04-17  5:44         ` Robert Pang
2025-04-15  1:57 ` [PATCH 0/1] bcache: reduce front IO latency during GC Coly Li
2025-04-22  1:44   ` Robert Pang
2025-05-02  1:01     ` Robert Pang
2025-05-03 17:33       ` Coly Li
2025-05-15  0:58         ` Robert Pang
2025-05-15  1:04           ` Robert Pang
2025-05-15  7:12           ` Kuan-Wei Chiu
2025-05-16  3:58             ` Robert Pang
2025-05-16 16:14               ` Kuan-Wei Chiu
2025-05-17 11:02                 ` Coly Li
2025-05-20 11:51                   ` Kuan-Wei Chiu
2025-05-20 12:13                     ` Coly Li
2025-05-20 12:26                       ` Kuan-Wei Chiu
2025-05-20 13:13                         ` Coly Li
2025-05-21 14:40                           ` Kuan-Wei Chiu
2025-06-06  7:39                             ` Robert Pang
2025-06-06 12:37                               ` Kuan-Wei Chiu
2025-07-03 15:28           ` Robert Pang
     [not found]             ` <10F3457F-FC71-4D21-B2CA-05346B68D873@coly.li>
     [not found]               ` <A52B16E2-DF9C-4C8A-9853-464385D1A7FA@coly.li>
2025-07-17 22:52                 ` Robert Pang
2025-07-18  6:09                   ` Coly Li
2025-05-16 17:10 ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox