]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: perf-counters for I/O performed by the scrubber
authorRonen Friedman <rfriedma@redhat.com>
Thu, 3 Apr 2025 07:55:23 +0000 (02:55 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Tue, 15 Apr 2025 09:58:05 +0000 (04:58 -0500)
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 <rfriedma@redhat.com>
src/osd/osd_perf_counters.cc
src/osd/osd_perf_counters.h
src/osd/scrubber/pg_scrubber.h
src/osd/scrubber_common.h

index def85209c4ec7e18dfe30e04a43a45a5a146264a..04baa8fa68561a662670a899b6532dd14a29e516 100644 (file)
@@ -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();
 }
index cccdb87a5381f67d145de3a5199e033823ce7dc8..c43906591e320e0573352bb6ac12f537e7dc05f6 100644 (file)
@@ -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,
 };
 
index f148101559f5586c7552472d1ce387d39ef41f89..273be33c028333eba7fbfa34a298bb7c7fcb30dc 100644 (file)
@@ -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
 
 
index edbc9599851694cf20f8475c61eadd5177adc8ce..19a3f141f92984f6a5b2b4161a29daf20cbd025f 100644 (file)
@@ -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