From 44bf5e27661329931bb4f21099d6c88f86d1d4cd Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Tue, 12 May 2020 17:47:47 +0800 Subject: [PATCH] librbd/rwl: track syncpoint's logentry number and write bytes The SyncPoint's logentry number and write bytes affect the peformance of rwl cache a lot. It needs to be tracked by perf couter for analysis. Signed-off-by: Changcheng Liu --- src/librbd/cache/ReplicatedWriteLog.cc | 23 +++++++++++++++++++++++ src/librbd/cache/rwl/SyncPoint.cc | 2 ++ src/librbd/cache/rwl/Types.h | 3 +++ 3 files changed, 28 insertions(+) diff --git a/src/librbd/cache/ReplicatedWriteLog.cc b/src/librbd/cache/ReplicatedWriteLog.cc index 434cdb511198d..16e67974f3d5e 100644 --- a/src/librbd/cache/ReplicatedWriteLog.cc +++ b/src/librbd/cache/ReplicatedWriteLog.cc @@ -99,6 +99,24 @@ void ReplicatedWriteLog::perf_start(std::string name) { 16, ///< Ranges into the mS }; + // Syncpoint logentry number x-axis configuration for op histograms + PerfHistogramCommon::axis_config_d sp_logentry_number_config{ + "logentry number", + PerfHistogramCommon::SCALE_LINEAR, // log entry number in linear scale + 0, // Start at 0 + 1, // Quantization unit is 1 + 260, // Up to 260 > (MAX_WRITES_PER_SYNC_POINT) + }; + + // Syncpoint bytes number y-axis configuration for op histogram + PerfHistogramCommon::axis_config_d sp_bytes_number_config{ + "Number of SyncPoint", + PerfHistogramCommon::SCALE_LOG2, // Request size in logarithmic scale + 0, // Start at 0 + 512, // Quantization unit is 512 + 17, // Writes up to 8M >= MAX_BYTES_PER_SYNC_POINT + }; + // Op size axis configuration for op histogram y axis, values are in bytes PerfHistogramCommon::axis_config_d op_hist_y_axis_config{ "Request size (bytes)", @@ -127,6 +145,11 @@ void ReplicatedWriteLog::perf_start(std::string name) { plb.add_u64_counter(l_librbd_rwl_rd_part_hit_req, "part_hit_rd", "reads partially hitting RWL"); + plb.add_u64_counter_histogram( + l_librbd_rwl_syncpoint_hist, "syncpoint_logentry_bytes_histogram", + sp_logentry_number_config, sp_bytes_number_config, + "Histogram of syncpoint's logentry numbers vs bytes number"); + plb.add_u64_counter(l_librbd_rwl_wr_req, "wr", "Writes"); plb.add_u64_counter(l_librbd_rwl_wr_req_def, "wr_def", "Writes deferred for resources"); plb.add_u64_counter(l_librbd_rwl_wr_req_def_lanes, "wr_def_lanes", "Writes deferred for lanes"); diff --git a/src/librbd/cache/rwl/SyncPoint.cc b/src/librbd/cache/rwl/SyncPoint.cc index cb3f3cfeebd91..19126acd66442 100644 --- a/src/librbd/cache/rwl/SyncPoint.cc +++ b/src/librbd/cache/rwl/SyncPoint.cc @@ -93,6 +93,8 @@ void SyncPoint::add_in_on_appending_ctxs(Context* ctx) { void SyncPoint::setup_earlier_sync_point(std::shared_ptr sync_point, uint64_t last_op_sequence_num) { + m_perfcounter->inc(l_librbd_rwl_syncpoint_hist, + sync_point->log_entry->writes, sync_point->log_entry->bytes); earlier_sync_point = sync_point; log_entry->prior_sync_point_flushed = false; earlier_sync_point->log_entry->next_sync_point_entry = log_entry; diff --git a/src/librbd/cache/rwl/Types.h b/src/librbd/cache/rwl/Types.h index a5f3dc2ec1839..4fb40433faa30 100644 --- a/src/librbd/cache/rwl/Types.h +++ b/src/librbd/cache/rwl/Types.h @@ -27,6 +27,9 @@ enum { // Reed requests with hit and miss extents l_librbd_rwl_rd_part_hit_req, // read ops + // Per SyncPoint's LogEntry number and write bytes distribution + l_librbd_rwl_syncpoint_hist, + // All write requests l_librbd_rwl_wr_req, // write requests l_librbd_rwl_wr_req_def, // write requests deferred for resources -- 2.39.5