]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: implement allocation perf histogram.
authorIgor Fedotov <ifedotov@suse.com>
Thu, 22 Jul 2021 16:39:21 +0000 (19:39 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 22 Jul 2021 16:45:14 +0000 (19:45 +0300)
This allows to monitor how fragmented resulting allocations are
depending on the requested block size.

Could be coupled with https://github.com/ceph/ceph/pull/41600/ for easy
live monitoring for either an individual OSD or full set of them.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 5368993ff0d2a3c24dfcd56f86c678b947f07606..cd3d33329ff7d3356d3020c2ec5484c30f9212d9 100644 (file)
@@ -5030,6 +5030,27 @@ void BlueStore::_init_logger()
   b.add_time_avg(l_bluestore_remove_lat, "remove_lat",
     "Average removal latency");
 
+  // Resulting size axis configuration for op histograms, values are in bytes
+  PerfHistogramCommon::axis_config_d alloc_hist_x_axis_config{
+    "Given size (bytes)",
+    PerfHistogramCommon::SCALE_LOG2, ///< Request size in logarithmic scale
+    0,                               ///< Start at 0
+    4096,                            ///< Quantization unit
+    13,                               ///< Enough to cover 4+M requests
+  };
+  // Req size axis configuration for op histograms, values are in bytes
+  PerfHistogramCommon::axis_config_d alloc_hist_y_axis_config{
+    "Request size (bytes)",
+    PerfHistogramCommon::SCALE_LOG2, ///< Request size in logarithmic scale
+    0,                               ///< Start at 0
+    4096,                            ///< Quantization unit
+    13,                               ///< Enough to cover 4+M requests
+  };
+  b.add_u64_counter_histogram(
+    l_bluestore_allocate_hist, "allocate_histogram",
+    alloc_hist_x_axis_config, alloc_hist_y_axis_config,
+    "Histogram of requested block allocations vs. given ones");
+
   logger = b.create_perf_counters();
   cct->get_perfcounters_collection()->add(logger);
 }
@@ -14138,7 +14159,7 @@ int BlueStore::_do_alloc_write(
     }
     return -ENOSPC;
   }
-  _collect_allocation_stats(need, min_alloc_size, prealloc.size());
+  _collect_allocation_stats(need, min_alloc_size, prealloc);
 
   dout(20) << __func__ << " prealloc " << prealloc << dendl;
   auto prealloc_pos = prealloc.begin();
@@ -16123,11 +16144,15 @@ void BlueStore::_log_alerts(osd_alert_list_t& alerts)
 }
 
 void BlueStore::_collect_allocation_stats(uint64_t need, uint32_t alloc_size,
-                                          size_t extents)
+                                          const PExtentVector& extents)
 {
   alloc_stats_count++;
-  alloc_stats_fragments += extents;
+  alloc_stats_fragments += extents.size();
   alloc_stats_size += need;
+
+  for (auto& e : extents) {
+    logger->hinc(l_bluestore_allocate_hist, e.length, need);
+  }
 }
 
 void BlueStore::_record_allocation_stats()
index c9f3167219214878e00021df75e9a6e46176cb48..a73b3b853359bfbab5b90f17b63b8d9bb18e643a 100644 (file)
@@ -144,6 +144,7 @@ enum {
   l_bluestore_omap_get_values_lat,
   l_bluestore_clist_lat,
   l_bluestore_remove_lat,
+  l_bluestore_allocate_hist,
   l_bluestore_last
 };
 
@@ -3357,7 +3358,7 @@ private:
                        unsigned bits);
 
   void _collect_allocation_stats(uint64_t need, uint32_t alloc_size,
-                                 size_t extents);
+                                 const PExtentVector&);
   void _record_allocation_stats();
 private:
   uint64_t probe_count = 0;