Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: WorkQueue: make wait timeout on empty queue configurable #3941

Merged
1 commit merged into from Mar 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/common/WorkQueue.cc
Expand Up @@ -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;

Expand Down
5 changes: 5 additions & 0 deletions src/common/config_opts.h
Expand Up @@ -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
Expand Down