Skip to content

Commit 3aa61b3

Browse files
committed
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 <[email protected]>
1 parent ef1d00c commit 3aa61b3

File tree

4 files changed

+73
-2
lines changed

4 files changed

+73
-2
lines changed

src/osd/osd_perf_counters.cc

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,25 @@ PerfCounters *build_osd_logger(CephContext *cct) {
356356
osd_plb.add_u64_counter(
357357
l_osd_watch_timeouts, "watch_timeouts",
358358
"Number of watches that timed out or were blocklisted",
359-
NULL, PerfCountersBuilder::PRIO_USEFUL);
359+
nullptr, PerfCountersBuilder::PRIO_USEFUL);
360+
361+
// scrub I/O (no EC vs. replicated differentiation)
362+
osd_plb.add_u64_counter(l_osd_scrub_omapgetheader_cnt, "scrub_omapgetheader_cnt", "scrub omap get header calls count");
363+
osd_plb.add_u64_counter(l_osd_scrub_omapgetheader_bytes, "scrub_omapgetheader_bytes", "scrub omap get header bytes read");
364+
osd_plb.add_u64_counter(l_osd_scrub_omapget_cnt, "scrub_omapget_cnt", "scrub omap get calls count");
365+
osd_plb.add_u64_counter(l_osd_scrub_omapget_bytes, "scrub_omapget_bytes", "scrub omap get bytes read");
366+
// scrub I/O performed for replicated pools
367+
osd_plb.add_u64_counter(l_osd_scrub_rppool_getattr_cnt, "scrub_replicated_getattr_cnt", "scrub replicated pool getattr calls count");
368+
osd_plb.add_u64_counter(l_osd_scrub_rppool_stats_cnt, "scrub_replicated_stats_cnt", "scrub replicated pool stats calls count");
369+
osd_plb.add_u64_counter(l_osd_scrub_rppool_read_cnt, "scrub_replicated_read_cnt", "scrub replicated pool read calls count");
370+
osd_plb.add_u64_counter(l_osd_scrub_rppool_read_bytes, "scrub_replicated_read_bytes", "scrub replicated pool read bytes read");
371+
// scrub I/O performed for EC pools
372+
osd_plb.add_u64_counter(l_osd_scrub_ec_getattr_cnt, "scrub_ec_getattr_cnt", "scrub ec getattr calls count");
373+
osd_plb.add_u64_counter(l_osd_scrub_ec_stats_cnt, "scrub_ec_stats_cnt", "scrub ec stats calls count");
374+
osd_plb.add_u64_counter(l_osd_scrub_ec_read_cnt, "scrub_ec_read_cnt", "scrub ec read calls count");
375+
osd_plb.add_u64_counter(l_osd_scrub_ec_read_bytes, "scrub_ec_read_bytes", "scrub ec read bytes read");
376+
377+
// scrub I/O performed for replicated pools
360378

361379
return osd_plb.create_perf_counters();
362380
}

src/osd/osd_perf_counters.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "common/perf_counters.h"
88
#include "common/perf_counters_key.h"
99

10-
enum {
10+
enum osd_counter_idx_t {
1111
l_osd_first = 10000,
1212
l_osd_op_wip,
1313
l_osd_op,
@@ -143,6 +143,22 @@ enum {
143143

144144
l_osd_watch_timeouts,
145145

146+
// scrub I/O (no EC vs. replicated differentiation)
147+
l_osd_scrub_omapgetheader_cnt, ///< omap get header calls count
148+
l_osd_scrub_omapgetheader_bytes, ///< bytes read by omap get header
149+
l_osd_scrub_omapget_cnt, ///< omap get calls count
150+
l_osd_scrub_omapget_bytes, ///< total bytes read by omap get
151+
// scrub I/O - replicated pools
152+
l_osd_scrub_rppool_getattr_cnt, ///< get_attr calls count
153+
l_osd_scrub_rppool_stats_cnt, ///< stats calls count
154+
l_osd_scrub_rppool_read_cnt, ///< read calls count
155+
l_osd_scrub_rppool_read_bytes, ///< total bytes read
156+
// scrub I/O - EC
157+
l_osd_scrub_ec_getattr_cnt, ///< get_attr calls count
158+
l_osd_scrub_ec_stats_cnt, ///< stats calls count
159+
l_osd_scrub_ec_read_cnt, ///< read calls count
160+
l_osd_scrub_ec_read_bytes, ///< total bytes read
161+
146162
l_osd_last,
147163
};
148164

src/osd/scrubber/pg_scrubber.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,29 @@ class MapsCollectionStatus {
133133
};
134134

135135

136+
// links to the two sets of I/O performance counters used by PgScrubber
137+
// (one to be used when in a replicated pool, and one for EC))
138+
static inline constexpr ScrubCounterSet io_counters_replicated{
139+
.getattr_cnt = l_osd_scrub_rppool_getattr_cnt,
140+
.stats_cnt = l_osd_scrub_rppool_stats_cnt,
141+
.read_cnt = l_osd_scrub_rppool_read_cnt,
142+
.read_bytes = l_osd_scrub_rppool_read_bytes,
143+
.omapgetheader_cnt = l_osd_scrub_omapgetheader_cnt,
144+
.omapgetheader_bytes = l_osd_scrub_omapgetheader_bytes,
145+
.omapget_cnt = l_osd_scrub_omapget_cnt,
146+
.omapget_bytes = l_osd_scrub_omapget_bytes
147+
};
148+
149+
static inline constexpr ScrubCounterSet io_counters_ec{
150+
.getattr_cnt = l_osd_scrub_ec_getattr_cnt,
151+
.stats_cnt = l_osd_scrub_ec_stats_cnt,
152+
.read_cnt = l_osd_scrub_ec_read_cnt,
153+
.read_bytes = l_osd_scrub_ec_read_bytes,
154+
.omapgetheader_cnt = l_osd_scrub_omapgetheader_cnt,
155+
.omapgetheader_bytes = l_osd_scrub_omapgetheader_bytes,
156+
.omapget_cnt = l_osd_scrub_omapget_cnt,
157+
.omapget_bytes = l_osd_scrub_omapget_bytes
158+
};
136159
} // namespace Scrub
137160

138161

src/osd/scrubber_common.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "include/types.h"
1616
#include "messages/MOSDScrubReserve.h"
1717
#include "os/ObjectStore.h"
18+
#include "osd/osd_perf_counters.h" // for osd_counter_idx_t
1819

1920
#include "OpRequest.h"
2021

@@ -288,6 +289,19 @@ struct PgScrubBeListener {
288289
virtual bool is_waiting_for_unreadable_object() const = 0;
289290
};
290291

292+
// defining a specific subset of performance counters. Each of the members
293+
// is set to (the index of) the corresponding performance counter.
294+
// Separate sets are used for replicated and erasure-coded pools.
295+
struct ScrubIoCounterSet {
296+
osd_counter_idx_t getattr_cnt; ///< get_attr calls count
297+
osd_counter_idx_t stats_cnt; ///< stats calls count
298+
osd_counter_idx_t read_cnt; ///< read calls count
299+
osd_counter_idx_t read_bytes; ///< total bytes read
300+
osd_counter_idx_t omapgetheader_cnt; ///< omap get header calls count
301+
osd_counter_idx_t omapgetheader_bytes; ///< bytes read by omap get header
302+
osd_counter_idx_t omapget_cnt; ///< omap get calls count
303+
osd_counter_idx_t omapget_bytes; ///< total bytes read by omap get
304+
};
291305
} // namespace Scrub
292306

293307

0 commit comments

Comments
 (0)