]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: instrument map cache hits and misses 9077/head
authorSage Weil <sage@redhat.com>
Tue, 10 May 2016 13:51:31 +0000 (09:51 -0400)
committerSage Weil <sage@redhat.com>
Tue, 10 May 2016 16:06:47 +0000 (12:06 -0400)
In particular, note misses that are below the map cache lower
bound, and the average distance below that lb.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index 13114349baf7a5123098069807862004cd2ced4b..bcfd094097f18ccb8e6ddb137eb6ca02f7135f80 100644 (file)
@@ -1326,8 +1326,20 @@ OSDMapRef OSDService::try_get_map(epoch_t epoch)
   OSDMapRef retval = map_cache.lookup(epoch);
   if (retval) {
     dout(30) << "get_map " << epoch << " -cached" << dendl;
+    if (logger) {
+      logger->inc(l_osd_map_cache_hit);
+    }
     return retval;
   }
+  if (logger) {
+    logger->inc(l_osd_map_cache_miss);
+    epoch_t lb = map_cache.cached_key_lower_bound();
+    if (epoch < lb) {
+      dout(30) << "get_map " << epoch << " - miss, below lower bound" << dendl;
+      logger->inc(l_osd_map_cache_miss_low);
+      logger->inc(l_osd_map_cache_miss_low_avg, lb - epoch);
+    }
+  }
 
   OSDMap *map = new OSDMap;
   if (epoch > 0) {
@@ -2491,6 +2503,10 @@ void OSD::create_logger()
   osd_plb.add_u64_counter(l_osd_mape, "map_message_epochs", "OSD map epochs");         // osdmap epochs
   osd_plb.add_u64_counter(l_osd_mape_dup, "map_message_epoch_dups", "OSD map duplicates"); // dup osdmap epochs
   osd_plb.add_u64_counter(l_osd_waiting_for_map, "messages_delayed_for_map", "Operations waiting for OSD map"); // dup osdmap epochs
+  osd_plb.add_u64_counter(l_osd_map_cache_hit, "osd_map_cache_hit", "osdmap cache hit");
+  osd_plb.add_u64_counter(l_osd_map_cache_miss, "osd_map_cache_miss", "osdmap cache miss");
+  osd_plb.add_u64_counter(l_osd_map_cache_miss_low, "osd_map_cache_miss_low", "osdmap cache miss below cache lower bound");
+  osd_plb.add_u64_avg(l_osd_map_cache_miss_low_avg, "osd_map_cache_miss_low_avg", "osdmap cache miss, avg distance below cache lower bound");
 
   osd_plb.add_u64(l_osd_stat_bytes, "stat_bytes", "OSD size");
   osd_plb.add_u64(l_osd_stat_bytes_used, "stat_bytes_used", "Used space");
index fd5bb23b388abc8729e4773076dddd43653a915d..9c7994ead3e7a1b65cfe0417d6cd856ff1fdbab2 100644 (file)
@@ -125,6 +125,11 @@ enum {
 
   l_osd_waiting_for_map,
 
+  l_osd_map_cache_hit,
+  l_osd_map_cache_miss,
+  l_osd_map_cache_miss_low,
+  l_osd_map_cache_miss_low_avg,
+
   l_osd_stat_bytes,
   l_osd_stat_bytes_used,
   l_osd_stat_bytes_avail,