Skip to content

Commit a8b12bb

Browse files
committed
mds: add some perf counters about cache trimming
Signed-off-by: haoyixing <[email protected]>
1 parent 352d1a4 commit a8b12bb

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

src/mds/MDCache.cc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6965,7 +6965,12 @@ std::pair<bool, uint64_t> MDCache::trim_lru(uint64_t count, expiremap& expiremap
69656965
bool throttled = false;
69666966
while (1) {
69676967
throttled |= trim_counter_start+trimmed >= trim_threshold;
6968-
if (throttled) break;
6968+
if (throttled) {
6969+
if (logger) {
6970+
logger->inc(l_mdss_cache_trim_throttle);
6971+
}
6972+
break;
6973+
}
69696974
CDentry *dn = static_cast<CDentry*>(bottom_lru.lru_expire());
69706975
if (!dn)
69716976
break;
@@ -6991,7 +6996,12 @@ std::pair<bool, uint64_t> MDCache::trim_lru(uint64_t count, expiremap& expiremap
69916996
// trim dentries from the LRU until count is reached
69926997
while (!throttled && (cache_toofull() || count > 0)) {
69936998
throttled |= trim_counter_start+trimmed >= trim_threshold;
6994-
if (throttled) break;
6999+
if (throttled) {
7000+
if (logger) {
7001+
logger->inc(l_mdss_cache_trim_throttle);
7002+
}
7003+
break;
7004+
}
69957005
CDentry *dn = static_cast<CDentry*>(lru.lru_expire());
69967006
if (!dn) {
69977007
break;

src/mds/Server.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ void Server::create_logger()
190190
PerfCountersBuilder::PRIO_INTERESTING);
191191
plb.add_u64_counter(l_mdss_cap_revoke_eviction, "cap_revoke_eviction",
192192
"Cap Revoke Client Eviction", "cre", PerfCountersBuilder::PRIO_INTERESTING);
193+
plb.add_u64_counter(l_mdss_cache_trim_throttle, "cache_trim_throttle",
194+
"Cache trim throttle counter", "ctt", PerfCountersBuilder::PRIO_INTERESTING);
195+
plb.add_u64_counter(l_mdss_session_recall_throttle, "session_recall_throttle",
196+
"Session recall throttle counter", "srt", PerfCountersBuilder::PRIO_INTERESTING);
197+
plb.add_u64_counter(l_mdss_session_recall_throttle2o, "session_recall_throttle2o",
198+
"Session recall throttle2o counter", "srt2", PerfCountersBuilder::PRIO_INTERESTING);
199+
plb.add_u64_counter(l_mdss_global_recall_throttle, "global_recall_throttle",
200+
"Global recall throttle counter", "grt", PerfCountersBuilder::PRIO_INTERESTING);
193201
plb.add_u64_counter(l_mdss_cap_acquisition_throttle,
194202
"cap_acquisition_throttle", "Cap acquisition throttle counter", "cat",
195203
PerfCountersBuilder::PRIO_INTERESTING);
@@ -1992,14 +2000,23 @@ std::pair<bool, uint64_t> Server::recall_client_state(MDSGatherBuilder* gather,
19922000
const uint64_t global_recall_throttle = recall_throttle.get();
19932001
if (session_recall_throttle+recall > recall_max_decay_threshold) {
19942002
dout(15) << " session recall threshold (" << recall_max_decay_threshold << ") hit at " << session_recall_throttle << "; skipping!" << dendl;
2003+
if (logger) {
2004+
logger->inc(l_mdss_session_recall_throttle);
2005+
}
19952006
throttled = true;
19962007
continue;
19972008
} else if (session_recall_throttle2o+recall > recall_max_caps*2) {
19982009
dout(15) << " session recall 2nd-order threshold (" << 2*recall_max_caps << ") hit at " << session_recall_throttle2o << "; skipping!" << dendl;
2010+
if (logger) {
2011+
logger->inc(l_mdss_session_recall_throttle2o);
2012+
}
19992013
throttled = true;
20002014
continue;
20012015
} else if (global_recall_throttle+recall > recall_global_max_decay_threshold) {
20022016
dout(15) << " global recall threshold (" << recall_global_max_decay_threshold << ") hit at " << global_recall_throttle << "; skipping!" << dendl;
2017+
if (logger) {
2018+
logger->inc(l_mdss_global_recall_throttle);
2019+
}
20032020
throttled = true;
20042021
break;
20052022
}

src/mds/Server.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ enum {
101101
l_mdss_req_symlink_latency,
102102
l_mdss_req_unlink_latency,
103103
l_mdss_cap_revoke_eviction,
104+
l_mdss_cache_trim_throttle,
105+
l_mdss_session_recall_throttle,
106+
l_mdss_session_recall_throttle2o,
107+
l_mdss_global_recall_throttle,
104108
l_mdss_cap_acquisition_throttle,
105109
l_mdss_req_getvxattr_latency,
106110
l_mdss_last,

0 commit comments

Comments
 (0)