From: Ronen Friedman Date: Thu, 3 Apr 2025 07:55:23 +0000 (-0500) Subject: osd/scrub: perf-counters for I/O performed by the scrubber X-Git-Tag: v20.3.0~85^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3aa61b365c0af0008cb8fd7be00d77a4cb507b28;p=ceph.git osd/scrub: perf-counters for I/O performed by the scrubber Define two sets of performance counters to track I/O performed by the scrubber - one set to be used when scrubbing a PG in a replicated pool, and one - for EC PGs. Signed-off-by: Ronen Friedman --- diff --git a/src/osd/osd_perf_counters.cc b/src/osd/osd_perf_counters.cc index def85209c4ec7..04baa8fa68561 100644 --- a/src/osd/osd_perf_counters.cc +++ b/src/osd/osd_perf_counters.cc @@ -356,7 +356,25 @@ PerfCounters *build_osd_logger(CephContext *cct) { osd_plb.add_u64_counter( l_osd_watch_timeouts, "watch_timeouts", "Number of watches that timed out or were blocklisted", - NULL, PerfCountersBuilder::PRIO_USEFUL); + nullptr, PerfCountersBuilder::PRIO_USEFUL); + + // scrub I/O (no EC vs. replicated differentiation) + osd_plb.add_u64_counter(l_osd_scrub_omapgetheader_cnt, "scrub_omapgetheader_cnt", "scrub omap get header calls count"); + osd_plb.add_u64_counter(l_osd_scrub_omapgetheader_bytes, "scrub_omapgetheader_bytes", "scrub omap get header bytes read"); + osd_plb.add_u64_counter(l_osd_scrub_omapget_cnt, "scrub_omapget_cnt", "scrub omap get calls count"); + osd_plb.add_u64_counter(l_osd_scrub_omapget_bytes, "scrub_omapget_bytes", "scrub omap get bytes read"); + // scrub I/O performed for replicated pools + osd_plb.add_u64_counter(l_osd_scrub_rppool_getattr_cnt, "scrub_replicated_getattr_cnt", "scrub replicated pool getattr calls count"); + osd_plb.add_u64_counter(l_osd_scrub_rppool_stats_cnt, "scrub_replicated_stats_cnt", "scrub replicated pool stats calls count"); + osd_plb.add_u64_counter(l_osd_scrub_rppool_read_cnt, "scrub_replicated_read_cnt", "scrub replicated pool read calls count"); + osd_plb.add_u64_counter(l_osd_scrub_rppool_read_bytes, "scrub_replicated_read_bytes", "scrub replicated pool read bytes read"); + // scrub I/O performed for EC pools + osd_plb.add_u64_counter(l_osd_scrub_ec_getattr_cnt, "scrub_ec_getattr_cnt", "scrub ec getattr calls count"); + osd_plb.add_u64_counter(l_osd_scrub_ec_stats_cnt, "scrub_ec_stats_cnt", "scrub ec stats calls count"); + osd_plb.add_u64_counter(l_osd_scrub_ec_read_cnt, "scrub_ec_read_cnt", "scrub ec read calls count"); + osd_plb.add_u64_counter(l_osd_scrub_ec_read_bytes, "scrub_ec_read_bytes", "scrub ec read bytes read"); + + // scrub I/O performed for replicated pools return osd_plb.create_perf_counters(); } diff --git a/src/osd/osd_perf_counters.h b/src/osd/osd_perf_counters.h index cccdb87a5381f..c43906591e320 100644 --- a/src/osd/osd_perf_counters.h +++ b/src/osd/osd_perf_counters.h @@ -7,7 +7,7 @@ #include "common/perf_counters.h" #include "common/perf_counters_key.h" -enum { +enum osd_counter_idx_t { l_osd_first = 10000, l_osd_op_wip, l_osd_op, @@ -143,6 +143,22 @@ enum { l_osd_watch_timeouts, + // scrub I/O (no EC vs. replicated differentiation) + l_osd_scrub_omapgetheader_cnt, ///< omap get header calls count + l_osd_scrub_omapgetheader_bytes, ///< bytes read by omap get header + l_osd_scrub_omapget_cnt, ///< omap get calls count + l_osd_scrub_omapget_bytes, ///< total bytes read by omap get + // scrub I/O - replicated pools + l_osd_scrub_rppool_getattr_cnt, ///< get_attr calls count + l_osd_scrub_rppool_stats_cnt, ///< stats calls count + l_osd_scrub_rppool_read_cnt, ///< read calls count + l_osd_scrub_rppool_read_bytes, ///< total bytes read + // scrub I/O - EC + l_osd_scrub_ec_getattr_cnt, ///< get_attr calls count + l_osd_scrub_ec_stats_cnt, ///< stats calls count + l_osd_scrub_ec_read_cnt, ///< read calls count + l_osd_scrub_ec_read_bytes, ///< total bytes read + l_osd_last, }; diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index f148101559f55..273be33c02833 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -133,6 +133,29 @@ class MapsCollectionStatus { }; +// links to the two sets of I/O performance counters used by PgScrubber +// (one to be used when in a replicated pool, and one for EC)) +static inline constexpr ScrubCounterSet io_counters_replicated{ + .getattr_cnt = l_osd_scrub_rppool_getattr_cnt, + .stats_cnt = l_osd_scrub_rppool_stats_cnt, + .read_cnt = l_osd_scrub_rppool_read_cnt, + .read_bytes = l_osd_scrub_rppool_read_bytes, + .omapgetheader_cnt = l_osd_scrub_omapgetheader_cnt, + .omapgetheader_bytes = l_osd_scrub_omapgetheader_bytes, + .omapget_cnt = l_osd_scrub_omapget_cnt, + .omapget_bytes = l_osd_scrub_omapget_bytes +}; + +static inline constexpr ScrubCounterSet io_counters_ec{ + .getattr_cnt = l_osd_scrub_ec_getattr_cnt, + .stats_cnt = l_osd_scrub_ec_stats_cnt, + .read_cnt = l_osd_scrub_ec_read_cnt, + .read_bytes = l_osd_scrub_ec_read_bytes, + .omapgetheader_cnt = l_osd_scrub_omapgetheader_cnt, + .omapgetheader_bytes = l_osd_scrub_omapgetheader_bytes, + .omapget_cnt = l_osd_scrub_omapget_cnt, + .omapget_bytes = l_osd_scrub_omapget_bytes +}; } // namespace Scrub diff --git a/src/osd/scrubber_common.h b/src/osd/scrubber_common.h index edbc959985169..19a3f141f9298 100644 --- a/src/osd/scrubber_common.h +++ b/src/osd/scrubber_common.h @@ -15,6 +15,7 @@ #include "include/types.h" #include "messages/MOSDScrubReserve.h" #include "os/ObjectStore.h" +#include "osd/osd_perf_counters.h" // for osd_counter_idx_t #include "OpRequest.h" @@ -288,6 +289,19 @@ struct PgScrubBeListener { virtual bool is_waiting_for_unreadable_object() const = 0; }; +// defining a specific subset of performance counters. Each of the members +// is set to (the index of) the corresponding performance counter. +// Separate sets are used for replicated and erasure-coded pools. +struct ScrubIoCounterSet { + osd_counter_idx_t getattr_cnt; ///< get_attr calls count + osd_counter_idx_t stats_cnt; ///< stats calls count + osd_counter_idx_t read_cnt; ///< read calls count + osd_counter_idx_t read_bytes; ///< total bytes read + osd_counter_idx_t omapgetheader_cnt; ///< omap get header calls count + osd_counter_idx_t omapgetheader_bytes; ///< bytes read by omap get header + osd_counter_idx_t omapget_cnt; ///< omap get calls count + osd_counter_idx_t omapget_bytes; ///< total bytes read by omap get +}; } // namespace Scrub