]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: add slop to agent mode selection
authorSage Weil <sage@inktank.com>
Tue, 28 Jan 2014 01:57:53 +0000 (17:57 -0800)
committerSage Weil <sage@inktank.com>
Sun, 16 Feb 2014 06:09:39 +0000 (22:09 -0800)
We want to avoid a situation where the agent clicks on and off when the
system hovers around a utilization threshold.  Particularly for trim,
the system can expend a lot of energy doing a minimal amount of work when
the effort level is low.  To avoid this, enable when we are some amount
above the threshold, and do not turn off until we are the same amount below
the target.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/osd/ReplicatedPG.cc

index 7f7dd2ef70cf180badab8073064a9f26cde8361f..40cebf9fccd11636dc1619a219b631319b86faa0 100644 (file)
@@ -393,6 +393,10 @@ OPTION(osd_agent_min_evict_effort, OPT_FLOAT, .05)
 // decay atime and hist histograms after how many objects go by
 OPTION(osd_agent_hist_halflife, OPT_INT, 1000)
 
+// must be this amount over the threshold to enable,
+// this amount below the threshold to disable.
+OPTION(osd_agent_slop, OPT_FLOAT, .02)
+
 OPTION(osd_uuid, OPT_UUID, uuid_d())
 OPTION(osd_data, OPT_STR, "/var/lib/ceph/osd/$cluster-$id")
 OPTION(osd_journal, OPT_STR, "/var/lib/ceph/osd/$cluster-$id/journal")
index 664c2e0f4b5ef612993898a6b9ab92200bb7d177..d06f0c3dda203550362a497a49e1923726be8478 100644 (file)
@@ -10457,23 +10457,35 @@ bool ReplicatedPG::agent_choose_mode()
 
   // flush mode
   TierAgentState::flush_mode_t flush_mode = TierAgentState::FLUSH_MODE_IDLE;
-  if (dirty_micro > pool.info.cache_target_dirty_ratio_micro)
+  uint64_t flush_target = pool.info.cache_target_dirty_ratio_micro;
+  uint64_t flush_slop = (float)flush_target * g_conf->osd_agent_slop;
+  if (agent_state->flush_mode == TierAgentState::FLUSH_MODE_IDLE)
+    flush_target += flush_slop;
+  else
+    flush_target -= MIN(flush_target, flush_slop);
+  if (dirty_micro > flush_target)
     flush_mode = TierAgentState::FLUSH_MODE_ACTIVE;
 
   // evict mode
   TierAgentState::evict_mode_t evict_mode = TierAgentState::EVICT_MODE_IDLE;
   unsigned evict_effort = 0;
+  uint64_t evict_target = pool.info.cache_target_full_ratio_micro;
+  uint64_t evict_slop = (float)evict_target * g_conf->osd_agent_slop;
+  if (agent_state->evict_mode == TierAgentState::EVICT_MODE_IDLE)
+    evict_target += evict_slop;
+  else
+    evict_target -= MIN(evict_target, evict_slop);
 
   if (full_micro > 1000000 ||
-      pool.info.cache_target_full_ratio_micro >= 1000000) {
+      evict_target >= 1000000) {
     // evict anything clean
     evict_mode = TierAgentState::EVICT_MODE_FULL;
     evict_effort = 1000000;
-  } else if (full_micro > pool.info.cache_target_full_ratio_micro) {
+  } else if (full_micro > evict_target) {
     // set effort in [0..1] range based on where we are between
     evict_mode = TierAgentState::EVICT_MODE_SOME;
-    uint64_t over = full_micro - pool.info.cache_target_full_ratio_micro;
-    uint64_t span = 1000000 - pool.info.cache_target_full_ratio_micro;
+    uint64_t over = full_micro - evict_target;
+    uint64_t span = 1000000 - evict_target;
     evict_effort = MIN(over * 1000000 / span,
                       (unsigned)(1000000.0 * g_conf->osd_agent_min_evict_effort));
   }