bcache: dynamic incremental gc
PATCH v2 1/1 bcache: dynamic incremental gc
From: ZouMingzhe <[email protected]>
Currently, GC is no more than 100 times, with at least 100 nodes each time, the maximum number of nodes each time is not limited.
According to our test data, when nvme is used as the cache, it takes about 1ms for GC to handle each node (block 4k and bucket 512k). This means that the latency during GC is at least 100ms. During GC, IO performance would be reduced by half or more.
I want to optimize the IOPS and latency under high pressure. This patch hold the inflight peak. When IO depth up to maximum, GC sleep immediately and handle these requests. Because each GC maybe only process very few nodes, GC would last a long time if sleep 100ms each time. So, the sleep time should be calculated dynamically based on gc_cost.
At the same time, I added some cost statistics, hoping to provide useful information for future work.
--- drivers/md/bcache/bcache.h | 8 ++++ drivers/md/bcache/btree.c | 92 ++++++++++++++++++++++++++++++++------ 2 files changed, 87 insertions(+), 13 deletions(-)
drivers/md/bcache/bcache.h +8 -0
@@ -471,6 +471,14 @@ struct cache { };struct gc_stat { +uint64_t gc_cost; +uint64_t sleep_cost; +uint64_t average_cost; +uint64_t start_time; +uint64_t finish_time; +size_t max_inflight; + +size_t times;size_t nodes;size_t nodes_pre;size_t key_bytes;
drivers/md/bcache/btree.c +79 -13
152 lines not on this page · raw message
Signature · 1 line
2.17.1