mds: make cache size health warning factor configurable

...now that it's used more than once place, copying around
the fraction was bad.

Signed-off-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2016-12-12 11:59:33 +00:00
parent 6b578e7f25
commit 57ac1af88f
3 changed files with 7 additions and 3 deletions

View File

@ -491,6 +491,7 @@ OPTION(mds_recall_state_timeout, OPT_FLOAT, 60) // detect clients which aren'
OPTION(mds_freeze_tree_timeout, OPT_FLOAT, 30) // detecting freeze tree deadlock
OPTION(mds_session_autoclose, OPT_FLOAT, 300) // autoclose idle session
OPTION(mds_health_summarize_threshold, OPT_INT, 10) // collapse N-client health metrics to a single 'many'
OPTION(mds_health_cache_threshold, OPT_FLOAT, 1.5) // warn on cache size if it exceeds mds_cache_size by this factor
OPTION(mds_reconnect_timeout, OPT_FLOAT, 45) // seconds to wait for clients during mds restart
// make it (mds_session_timeout - mds_beacon_grace)
OPTION(mds_tick_interval, OPT_FLOAT, 5)

View File

@ -482,7 +482,8 @@ void Beacon::notify_health(MDSRank const *mds)
}
// Report if we have significantly exceeded our cache size limit
if (mds->mdcache->get_num_inodes() > g_conf->mds_cache_size * 1.5) {
if (mds->mdcache->get_num_inodes() >
g_conf->mds_cache_size * g_conf->mds_health_cache_threshold) {
std::ostringstream oss;
oss << "Too many inodes in cache (" << mds->mdcache->get_num_inodes()
<< "/" << g_conf->mds_cache_size << "), "

View File

@ -282,7 +282,8 @@ void MDCache::add_inode(CInode *in)
base_inodes.insert(in);
}
if (get_num_inodes() > g_conf->mds_cache_size * 1.5) {
if (get_num_inodes() >
g_conf->mds_cache_size * g_conf->mds_health_cache_threshold) {
exceeded_size_limit = true;
}
}
@ -7388,7 +7389,8 @@ void MDCache::check_memory_usage()
// now, free any unused pool memory so that our memory usage isn't
// permanently bloated.
if (exceeded_size_limit
&& get_num_inodes() <= g_conf->mds_cache_size * 1.5) {
&& get_num_inodes() <=
g_conf->mds_cache_size * g_conf->mds_health_cache_threshold) {
// Only do this once we are back in bounds: otherwise the releases would
// slow down whatever process caused us to exceed bounds to begin with
dout(2) << "check_memory_usage: releasing unused space from pool allocators"