From: Sage Weil Date: Mon, 30 Jan 2017 21:51:32 +0000 (-0500) Subject: mon: add a threadpool (cpu_tp) X-Git-Tag: v12.0.1~343^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e2041f8ebdafd425f64fffb4898349b2e14510a;p=ceph.git mon: add a threadpool (cpu_tp) Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index b4e588242908d..8d0538992d9a0 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index f23f91a7b8b67..b09638dd09737 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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) { diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 3e2ab50baaac9..7465a5f9b70ee 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -44,6 +44,7 @@ #include #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