From dc400ca98bc8f8bbcd89f38118b7ba382abc0499 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 13 May 2022 16:40:26 +0800 Subject: [PATCH] crimson/os/seastore/segment_cleaner: add metrics about why IO is blocking Signed-off-by: Yingxin Cheng --- src/crimson/os/seastore/segment_cleaner.cc | 4 ++++ src/crimson/os/seastore/segment_cleaner.h | 28 ++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/crimson/os/seastore/segment_cleaner.cc b/src/crimson/os/seastore/segment_cleaner.cc index 56e5ab8920a..ead4f7ec72c 100644 --- a/src/crimson/os/seastore/segment_cleaner.cc +++ b/src/crimson/os/seastore/segment_cleaner.cc @@ -510,6 +510,10 @@ void SegmentCleaner::register_metrics() sm::description("the sum of IOs")), sm::make_counter("io_blocked_count", stats.io_blocked_count, sm::description("IOs that are blocked by gc")), + sm::make_counter("io_blocked_count_trim", stats.io_blocked_count_trim, + sm::description("IOs that are blocked by trimming")), + sm::make_counter("io_blocked_count_reclaim", stats.io_blocked_count_reclaim, + sm::description("IOs that are blocked by reclaimming")), sm::make_counter("io_blocked_sum", stats.io_blocked_sum, sm::description("the sum of blocking IOs")), diff --git a/src/crimson/os/seastore/segment_cleaner.h b/src/crimson/os/seastore/segment_cleaner.h index d6e4e6b91bb..e828bb586e4 100644 --- a/src/crimson/os/seastore/segment_cleaner.h +++ b/src/crimson/os/seastore/segment_cleaner.h @@ -658,6 +658,8 @@ private: uint64_t io_blocking_num = 0; uint64_t io_count = 0; uint64_t io_blocked_count = 0; + uint64_t io_blocked_count_trim = 0; + uint64_t io_blocked_count_reclaim = 0; uint64_t io_blocked_sum = 0; uint64_t reclaiming_bytes = 0; @@ -1186,10 +1188,11 @@ private: * * Encapsulates whether block pending gc. */ - bool should_block_on_gc() const { - if (get_dirty_tail_limit() > journal_tail_target) { - return true; - } + bool should_block_on_trim() const { + return get_dirty_tail_limit() > journal_tail_target; + } + + bool should_block_on_reclaim() const { if (get_segments_reclaimable() == 0) { return false; } @@ -1202,6 +1205,10 @@ private: ); } + bool should_block_on_gc() const { + return should_block_on_trim() || should_block_on_reclaim(); + } + void log_gc_state(const char *caller) const { auto &logger = crimson::get_logger(ceph_subsys_seastore_cleaner); if (logger.is_enabled(seastar::log_level::debug)) { @@ -1256,13 +1263,20 @@ public: // The pipeline configuration prevents another IO from entering // prepare until the prior one exits and clears this. ceph_assert(!blocked_io_wake); - bool is_blocked = false; ++stats.io_count; - if (should_block_on_gc()) { + bool is_blocked = false; + if (should_block_on_trim()) { + is_blocked = true; + ++stats.io_blocked_count_trim; + } + if (should_block_on_reclaim()) { + is_blocked = true; + ++stats.io_blocked_count_reclaim; + } + if (is_blocked) { ++stats.io_blocking_num; ++stats.io_blocked_count; stats.io_blocked_sum += stats.io_blocking_num; - is_blocked = true; } return seastar::do_until( [this] { -- 2.39.5