]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/msgr: test DispatchQueue throttling
authorJos Collin <jcollin@redhat.com>
Thu, 18 Dec 2025 11:48:43 +0000 (17:18 +0530)
committerJos Collin <jcollin@redhat.com>
Mon, 22 Dec 2025 09:02:27 +0000 (14:32 +0530)
Fixes: https://tracker.ceph.com/issues/46226
Signed-off-by: Jos Collin <jcollin@redhat.com>
src/test/msgr/test_msgr.cc

index f7fa960052a59d931d5c993de6aad05c2e4a25b2..82ffc01357ebaf2aa6f291441b9c1e669eb8451d 100644 (file)
@@ -1834,6 +1834,15 @@ class SyntheticDispatcher : public Dispatcher {
     return true;
   }
 
+  bool ms_handle_throttle(ms_throttle_t ttype, const ThrottleInfo& tinfo) override {
+    switch(ttype) {
+    case ms_throttle_t::DISPATCH_QUEUE:
+      return true;
+    default:
+      return false;
+    }
+  }
+
   void reply_message(const Message *m, Payload& pl) {
     pl.who = Payload::PONG;
     bufferlist bl;
@@ -2372,6 +2381,26 @@ TEST_P(MessengerTest, SyntheticInjectTest5) {
   test_msg.wait_for_done();
 }
 
+TEST_P(MessengerTest, SyntheticInjectTest6) {
+  g_ceph_context->_conf.set_val("ms_dispatch_throttle_bytes", "500");
+  g_ceph_context->_conf.set_val("ms_dispatch_throttle_log_interval", "5");
+  SyntheticWorkload test_msg(1, 8, GetParam(), 100,
+                             Messenger::Policy::stateful_server(0),
+                             Messenger::Policy::lossless_client(0));
+  for (int i = 0; i < 2; ++i) {
+    test_msg.generate_connection();
+  }
+  for (int i = 0; i < 1000; ++i) {
+    if (!(i % 10)) {
+      ldout(g_ceph_context, 0) << "Op " << i << ": " << dendl;
+      test_msg.print_internal_state();
+    }
+    test_msg.send_message();
+  }
+  test_msg.wait_for_done();
+  g_ceph_context->_conf.set_val("ms_dispatch_throttle_bytes", "104857600");
+  g_ceph_context->_conf.set_val("ms_dispatch_throttle_log_interval", "30");
+}
 
 class MarkdownDispatcher : public Dispatcher {
   ceph::mutex lock = ceph::make_mutex("MarkdownDispatcher::lock");