From 57ac1af88f780378fb7d827d97590440fb5ce7c4 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 12 Dec 2016 11:59:33 +0000 Subject: [PATCH] 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 --- src/common/config_opts.h | 1 + src/mds/Beacon.cc | 3 ++- src/mds/MDCache.cc | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 5695823ef315..ff57ccf45a86 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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) diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index ec251fc24b2c..285583b6780b 100644 --- a/src/mds/Beacon.cc +++ b/src/mds/Beacon.cc @@ -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 << "), " diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 89c8068bcfa6..2d6e412b29f7 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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" -- 2.47.3