From: haoyixing Date: Mon, 7 Apr 2025 09:08:53 +0000 (+0800) Subject: mds: add some perf counters about cache trimming X-Git-Tag: v21.0.0~256^2~676^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a8b12bbc8c943b496960b64cbb6043931711e88d;p=ceph.git mds: add some perf counters about cache trimming Signed-off-by: haoyixing --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index c432fe4beb3b..8c3630a323bd 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6965,7 +6965,12 @@ std::pair MDCache::trim_lru(uint64_t count, expiremap& expiremap bool throttled = false; while (1) { throttled |= trim_counter_start+trimmed >= trim_threshold; - if (throttled) break; + if (throttled) { + if (logger) { + logger->inc(l_mdss_cache_trim_throttle); + } + break; + } CDentry *dn = static_cast(bottom_lru.lru_expire()); if (!dn) break; @@ -6991,7 +6996,12 @@ std::pair MDCache::trim_lru(uint64_t count, expiremap& expiremap // trim dentries from the LRU until count is reached while (!throttled && (cache_toofull() || count > 0)) { throttled |= trim_counter_start+trimmed >= trim_threshold; - if (throttled) break; + if (throttled) { + if (logger) { + logger->inc(l_mdss_cache_trim_throttle); + } + break; + } CDentry *dn = static_cast(lru.lru_expire()); if (!dn) { break; diff --git a/src/mds/Server.cc b/src/mds/Server.cc index fe862d3cc080..43e37fe752b4 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -190,6 +190,14 @@ void Server::create_logger() PerfCountersBuilder::PRIO_INTERESTING); plb.add_u64_counter(l_mdss_cap_revoke_eviction, "cap_revoke_eviction", "Cap Revoke Client Eviction", "cre", PerfCountersBuilder::PRIO_INTERESTING); + plb.add_u64_counter(l_mdss_cache_trim_throttle, "cache_trim_throttle", + "Cache trim throttle counter", "ctt", PerfCountersBuilder::PRIO_INTERESTING); + plb.add_u64_counter(l_mdss_session_recall_throttle, "session_recall_throttle", + "Session recall throttle counter", "srt", PerfCountersBuilder::PRIO_INTERESTING); + plb.add_u64_counter(l_mdss_session_recall_throttle2o, "session_recall_throttle2o", + "Session recall throttle2o counter", "srt2", PerfCountersBuilder::PRIO_INTERESTING); + plb.add_u64_counter(l_mdss_global_recall_throttle, "global_recall_throttle", + "Global recall throttle counter", "grt", PerfCountersBuilder::PRIO_INTERESTING); plb.add_u64_counter(l_mdss_cap_acquisition_throttle, "cap_acquisition_throttle", "Cap acquisition throttle counter", "cat", PerfCountersBuilder::PRIO_INTERESTING); @@ -1992,14 +2000,23 @@ std::pair Server::recall_client_state(MDSGatherBuilder* gather, const uint64_t global_recall_throttle = recall_throttle.get(); if (session_recall_throttle+recall > recall_max_decay_threshold) { dout(15) << " session recall threshold (" << recall_max_decay_threshold << ") hit at " << session_recall_throttle << "; skipping!" << dendl; + if (logger) { + logger->inc(l_mdss_session_recall_throttle); + } throttled = true; continue; } else if (session_recall_throttle2o+recall > recall_max_caps*2) { dout(15) << " session recall 2nd-order threshold (" << 2*recall_max_caps << ") hit at " << session_recall_throttle2o << "; skipping!" << dendl; + if (logger) { + logger->inc(l_mdss_session_recall_throttle2o); + } throttled = true; continue; } else if (global_recall_throttle+recall > recall_global_max_decay_threshold) { dout(15) << " global recall threshold (" << recall_global_max_decay_threshold << ") hit at " << global_recall_throttle << "; skipping!" << dendl; + if (logger) { + logger->inc(l_mdss_global_recall_throttle); + } throttled = true; break; } diff --git a/src/mds/Server.h b/src/mds/Server.h index 5fb554dada7b..7a05a425bd06 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -101,6 +101,10 @@ enum { l_mdss_req_symlink_latency, l_mdss_req_unlink_latency, l_mdss_cap_revoke_eviction, + l_mdss_cache_trim_throttle, + l_mdss_session_recall_throttle, + l_mdss_session_recall_throttle2o, + l_mdss_global_recall_throttle, l_mdss_cap_acquisition_throttle, l_mdss_req_getvxattr_latency, l_mdss_last,