From: Kamoltat Date: Wed, 17 Nov 2021 20:34:48 +0000 (+0000) Subject: pybind/mgr/pg_autoscale: revert to default profile scale-up X-Git-Tag: v16.2.7~15^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f81b87bc79f2a90b30d3b1af863270ca8e639aca;p=ceph.git pybind/mgr/pg_autoscale: revert to default profile scale-up pg_autoscale module will now start out all the pools with a scale-up profile by default. Added tests in workunits/mon/pg_autoscaler.sh to evaluate if the default pool creation is a scale-up profile Updated documentation and release notes to reflect the change in the default behavior of the pg_autoscale profile. Fixes: https://tracker.ceph.com/issues/53309 Signed-off-by: Kamoltat (cherry picked from commit a9f9f7b3fd813d429c4a539edf560d3fb6eb553b) Conflicts: src/pybind/mgr/pg_autoscaler/module.py - trivial fix --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 8d8a502666541..4bbf36c37b45e 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -44,9 +44,9 @@ >=16.2.6 -------- -* MGR: The pg_autoscaler has a new default 'scale-down' profile which provides more - performance from the start for new pools (for newly created clusters). - Existing clusters will retain the old behavior, now called the 'scale-up' profile. +* MGR: The pg_autoscaler has a new 'scale-down' profile which provides more + performance from the start for new pools. However, the module will remain + using it old behavior by default, now called the 'scale-up' profile. For more details, see: https://docs.ceph.com/en/latest/rados/operations/placement-groups/ diff --git a/doc/rados/operations/placement-groups.rst b/doc/rados/operations/placement-groups.rst index 947fdb1568cb4..d494f430034a4 100644 --- a/doc/rados/operations/placement-groups.rst +++ b/doc/rados/operations/placement-groups.rst @@ -121,24 +121,24 @@ example, a pool that maps to OSDs of class `ssd` and a pool that maps to OSDs of class `hdd` will each have optimal PG counts that depend on the number of those respective device types. -The autoscaler uses the `scale-down` profile by default, -where each pool starts out with a full complements of PGs and only scales -down when the usage ratio across the pools is not even. However, it also has -a `scale-up` profile, where it starts out each pool with minimal PGs and scales -up PGs when there is more usage in each pool. +The autoscaler uses the `scale-up` profile by default, +where it starts out each pool with minimal PGs and scales +up PGs when there is more usage in each pool. However, it also has +a `scale-down` profile, where each pool starts out with a full complements +of PGs and only scales down when the usage ratio across the pools is not even. With only the `scale-down` profile, the autoscaler identifies any overlapping roots and prevents the pools with such roots from scaling because overlapping roots can cause problems with the scaling process. -To use the `scale-up` profile:: +To use the `scale-down` profile:: - ceph osd pool set autoscale-profile scale-up + ceph osd pool set autoscale-profile scale-down -To switch back to the default `scale-down` profile:: +To switch back to the default `scale-up` profile:: - ceph osd pool set autoscale-profile scale-down + ceph osd pool set autoscale-profile scale-up Existing clusters will continue to use the `scale-up` profile. To use the `scale-down` profile, users will need to set autoscale-profile `scale-down`, diff --git a/qa/workunits/mon/pg_autoscaler.sh b/qa/workunits/mon/pg_autoscaler.sh index 3d24b1a6c50c2..215b587078f0c 100755 --- a/qa/workunits/mon/pg_autoscaler.sh +++ b/qa/workunits/mon/pg_autoscaler.sh @@ -45,6 +45,56 @@ ceph osd pool set b pg_autoscale_mode on # get num pools again since we created more pools NUM_POOLS=$(ceph osd pool ls | wc -l) +# get profiles of pool a and b +PROFILE1=$(ceph osd pool autoscale-status | grep 'a' | grep -o -m 1 'scale-up\|scale-down' || true) +PROFILE2=$(ceph osd pool autoscale-status | grep 'b' | grep -o -m 1 'scale-up\|scale-down' || true) + +# evaluate the default profile a +if [[ $PROFILE1 = "scale-up" ]] +then + echo "Success: pool a PROFILE is scale-up" +else + echo "Error: a PROFILE is scale-down" + exit 1 +fi + +# evaluate the default profile of pool b +if [[ $PROFILE2 = "scale-up" ]] +then + echo "Success: pool b PROFILE is scale-up" +else + echo "Error: b PROFILE is scale-down" + exit 1 +fi + +# This part of this code will now evaluate the accuracy of +# scale-down profile + +# change to scale-down profile +ceph osd pool set autoscale-profile scale-down + +# get profiles of pool a and b +PROFILE1=$(ceph osd pool autoscale-status | grep 'a' | grep -o -m 1 'scale-up\|scale-down' || true) +PROFILE2=$(ceph osd pool autoscale-status | grep 'b' | grep -o -m 1 'scale-up\|scale-down' || true) + +# evaluate that profile a is now scale-down +if [[ $PROFILE1 = "scale-down" ]] +then + echo "Success: pool a PROFILE is scale-down" +else + echo "Error: a PROFILE is scale-up" + exit 1 +fi + +# evaluate the profile of b is now scale-down +if [[ $PROFILE2 = "scale-down" ]] +then + echo "Success: pool b PROFILE is scale-down" +else + echo "Error: b PROFILE is scale-up" + exit 1 +fi + # get pool size POOL_SIZE_A=$(ceph osd pool get a size| grep -Eo '[0-9]{1,4}') POOL_SIZE_B=$(ceph osd pool get b size| grep -Eo '[0-9]{1,4}') diff --git a/src/mon/KVMonitor.cc b/src/mon/KVMonitor.cc index 4d24d727bbe0a..defa0e82a7839 100644 --- a/src/mon/KVMonitor.cc +++ b/src/mon/KVMonitor.cc @@ -48,7 +48,7 @@ void KVMonitor::create_initial() version = 0; pending.clear(); bufferlist bl; - bl.append("scale-down"); + bl.append("scale-up"); pending["config/mgr/mgr/pg_autoscaler/autoscale_profile"] = bl; } diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index c57a5feb35dcd..d3d960cdfb0f4 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -131,11 +131,11 @@ class PgAutoscaler(MgrModule): default='scale-up', type='str', desc='pg_autoscale profiler', - long_desc=('Determines the behavior of the autoscaler algorithm ' + long_desc=('Determines the behavior of the autoscaler algorithm, ' '`scale-up` means that it starts out with minmum pgs ' - 'and scales up when there is pressure, `scale-down` ' - 'means starts out with full pgs and scales down when ' - 'there is pressure '), + 'and scales up when there is pressure' + '`scale-down means start out with full pgs and scales' + 'down when there is pressure'), runtime=True), ]