]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: count transactions pending on seastore's throttler 50176/head
authorXuehan Xu <xxhdx1985126@gmail.com>
Mon, 20 Feb 2023 08:44:29 +0000 (08:44 +0000)
committerXuehan Xu <xxhdx1985126@gmail.com>
Mon, 20 Feb 2023 08:44:29 +0000 (08:44 +0000)
Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
src/crimson/common/throttle.cc
src/crimson/common/throttle.h
src/crimson/os/seastore/seastore.cc

index 8aeaa1fdd7d9fd75420c42d2fd506562a1a7d1f5..88d1859f32f586e912cbf96daef96944758bfd10 100644 (file)
@@ -1,3 +1,6 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
+// vim: ts=8 sw=2 smarttab
+
 #include "throttle.h"
 
 namespace crimson::common {
@@ -29,9 +32,11 @@ seastar::future<> Throttle::get(size_t c)
   if (max == 0u) {
     return seastar::make_ready_future<>();
   }
+  pending++;
   return on_free_slots.wait([this, c] {
     return !_should_wait(c);
   }).then([this, c] {
+    pending--;
     count += c;
     return seastar::make_ready_future<>();
   });
index fea471c8d61fdd9236c16a8bfecb19d1cec0c541..2998cb5f84317cf884b693e4fd9c07a69b827440 100644 (file)
@@ -15,6 +15,7 @@ namespace crimson::common {
 class Throttle final : public ThrottleInterface {
   size_t max = 0;
   size_t count = 0;
+  size_t pending = 0;
   // we cannot change the "count" of seastar::semaphore after it is created,
   // so use condition_variable instead.
   seastar::condition_variable on_free_slots;
@@ -31,6 +32,9 @@ public:
   size_t get_max() const {
     return max;
   }
+  size_t get_pending() const {
+    return pending;
+  }
   void reset_max(size_t m);
 private:
   bool _should_wait(size_t c) const;
index 6680f52a80a6c7252875d29b91ca2f1937af4f19..04522f1e7ad779b93583072daefab52c14aa7749 100644 (file)
@@ -173,6 +173,14 @@ void SeaStore::register_metrics()
          return throttler.get_current();
        },
        sm::description("transactions that are running inside seastore")
+      ),
+      sm::make_gauge(
+       "pending_transactions",
+       [this] {
+         return throttler.get_pending();
+       },
+       sm::description("transactions waiting to get "
+                       "through seastore's throttler")
       )
     }
   );