From ca96b59db529ffbba0c834795800b6e90a7e4fce Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 9 Feb 2015 17:11:38 -0800 Subject: [PATCH] WorkQueue: make wait timeout on empty queue configurable Fixes: 10817 Backport: giant, firefly, dumpling Signed-off-by: Samuel Just (cherry picked from commit 5aa6f910843e98a05bfcabe6f29d612cf335edbf) --- src/common/WorkQueue.cc | 9 +++++++-- src/common/config_opts.h | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/WorkQueue.cc b/src/common/WorkQueue.cc index 0f8bc9d4f9369..8559b03aa9f1d 100644 --- a/src/common/WorkQueue.cc +++ b/src/common/WorkQueue.cc @@ -142,8 +142,13 @@ void ThreadPool::worker(WorkThread *wt) } ldout(cct,20) << "worker waiting" << dendl; - cct->get_heartbeat_map()->reset_timeout(hb, 4, 0); - _cond.WaitInterval(cct, _lock, utime_t(2, 0)); + cct->get_heartbeat_map()->reset_timeout( + hb, + cct->_conf->threadpool_default_timeout, + 0); + _cond.WaitInterval(cct, _lock, + utime_t( + cct->_conf->threadpool_empty_queue_max_wait, 0)); } ldout(cct,1) << "worker finish" << dendl; diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 03074412a3f35..d8ecdc70357c7 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -570,6 +570,11 @@ OPTION(osd_leveldb_log, OPT_STR, "") // enable OSD leveldb log file // determines whether PGLog::check() compares written out log to stored log OPTION(osd_debug_pg_log_writeout, OPT_BOOL, false) +// default timeout while caling WaitInterval on an empty queue +OPTION(threadpool_default_timeout, OPT_INT, 60) +// default wait time for an empty queue before pinging the hb timeout +OPTION(threadpool_empty_queue_max_wait, OPT_INT, 2) + OPTION(leveldb_write_buffer_size, OPT_U64, 8 *1024*1024) // leveldb write buffer size OPTION(leveldb_cache_size, OPT_U64, 128 *1024*1024) // leveldb cache size OPTION(leveldb_block_size, OPT_U64, 0) // leveldb block size -- 2.39.5