]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/pg_autoscaler: apply bias to pg_num selection 27387/head
authorSage Weil <sage@redhat.com>
Mon, 25 Mar 2019 11:39:28 +0000 (06:39 -0500)
committerSage Weil <sage@redhat.com>
Thu, 4 Apr 2019 22:05:20 +0000 (17:05 -0500)
This is a relatively naive way to apply the bias: we just multiply it
to whatever we would have chosen.  A more clever approach would be to
factor this into the overall cluster-wide PG budget, so that biasing one
pool's PGs up would put downward pressure on other pools.  That is
significantly more complicated, however, and (I think) not worth the
effort.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit e7ad0eeaaa3a73b5b78764d86eb634ca7072afd1)

src/pybind/mgr/pg_autoscaler/module.py

index 2a1cf978c4afabdccf5c89b3eb56e382829ddd74..2c9c6dbe3231cb00e8b4f482df02435e006a360d 100644 (file)
@@ -268,6 +268,7 @@ class PgAutoscaler(MgrModule):
             raw_used_rate = osdmap.pool_raw_used_rate(pool_id)
 
             pool_logical_used = pool_stats[pool_id]['bytes_used']
+            bias = p['options'].get('pg_autoscale_bias', 1.0)
             target_bytes = p['options'].get('target_size_bytes', 0)
 
             # What proportion of space are we using?
@@ -281,16 +282,17 @@ class PgAutoscaler(MgrModule):
             final_ratio = max(capacity_ratio, target_ratio)
 
             # So what proportion of pg allowance should we be using?
-            pool_pg_target = (final_ratio * root_map[root_id].pg_target) / raw_used_rate
+            pool_pg_target = (final_ratio * root_map[root_id].pg_target) / raw_used_rate * bias
 
             final_pg_target = max(p['options'].get('pg_num_min', PG_NUM_MIN),
                                   nearest_power_of_two(pool_pg_target))
 
-            self.log.info("Pool '{0}' root_id {1} using {2} of space, "
-                          "pg target {3} quantized to {4} (current {5})".format(
+            self.log.info("Pool '{0}' root_id {1} using {2} of space, bias {3}, "
+                          "pg target {4} quantized to {5} (current {6})".format(
                               p['pool_name'],
                               root_id,
                               final_ratio,
+                              bias,
                               pool_pg_target,
                               final_pg_target,
                               p['pg_num_target']