]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add a threadpool (cpu_tp)
authorSage Weil <sage@redhat.com>
Mon, 30 Jan 2017 21:51:32 +0000 (16:51 -0500)
committerSage Weil <sage@redhat.com>
Thu, 16 Feb 2017 17:04:07 +0000 (12:04 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/mon/Monitor.cc
src/mon/Monitor.h

index b4e588242908d4f01c4861ae1fcac1f9c2e7ff94..8d0538992d9a0174c7de932ab99c4ed741c122d1 100644 (file)
@@ -260,6 +260,7 @@ OPTION(mon_compact_on_bootstrap, OPT_BOOL, false)  // trigger leveldb compaction
 OPTION(mon_compact_on_trim, OPT_BOOL, true)       // compact (a prefix) when we trim old states
 OPTION(mon_osd_cache_size, OPT_INT, 10)  // the size of osdmaps cache, not to rely on underlying store's cache
 
+OPTION(mon_cpu_threads, OPT_INT, 4)
 OPTION(mon_tick_interval, OPT_INT, 5)
 OPTION(mon_session_timeout, OPT_INT, 300)    // must send keepalive or subscribe
 OPTION(mon_subscribe_interval, OPT_DOUBLE, 24*3600)  // for legacy clients only
index f23f91a7b8b67cf43ee85f83dc7fd4f67730381c..b09638dd09737ea5095f9020b6a698d49d89f91f 100644 (file)
@@ -141,6 +141,7 @@ Monitor::Monitor(CephContext* cct_, string nm, MonitorDBStore *s,
   con_self(m ? m->get_loopback_connection() : NULL),
   lock("Monitor::lock"),
   timer(cct_, lock),
+  cpu_tp(cct, "Monitor::cpu_tp", "cpu_tp", g_conf->mon_cpu_threads),
   has_ever_joined(false),
   logger(NULL), cluster_logger(NULL), cluster_logger_registered(false),
   monmap(map),
@@ -939,6 +940,8 @@ int Monitor::init()
   timer.init();
   new_tick();
 
+  cpu_tp.start();
+
   // i'm ready!
   messenger->add_dispatcher_tail(this);
 
@@ -1063,6 +1066,8 @@ void Monitor::shutdown()
 
   timer.shutdown();
 
+  cpu_tp.stop();
+
   remove_all_sessions();
 
   if (logger) {
index 3e2ab50baaac9b3a23a09c9be6e92d8043381848..7465a5f9b70ee74e7deed8dfe6374b6665ce5452 100644 (file)
@@ -44,6 +44,7 @@
 #include <cmath>
 
 #include "mon/MonOpRequest.h"
+#include "common/WorkQueue.h"
 
 
 #define CEPH_MON_PROTOCOL     13 /* cluster internal */
@@ -121,6 +122,7 @@ public:
   ConnectionRef con_self;
   Mutex lock;
   SafeTimer timer;
+  ThreadPool cpu_tp;  ///< threadpool for CPU intensive work
   
   /// true if we have ever joined a quorum.  if false, we are either a
   /// new cluster, a newly joining monitor, or a just-upgraded