From: Kyle Date: Tue, 10 Aug 2021 22:43:52 +0000 (-0700) Subject: mgr/pg_autoscaler: add threshold module option X-Git-Tag: v17.1.0~1007^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0f6184fc3dd23e9a1fb7f541fbf29c96ddf4b325;p=ceph.git mgr/pg_autoscaler: add threshold module option Signed-off-by: Kyle McGough --- diff --git a/doc/rados/operations/placement-groups.rst b/doc/rados/operations/placement-groups.rst index d3f1c5b7430d..d282d9e5bee3 100644 --- a/doc/rados/operations/placement-groups.rst +++ b/doc/rados/operations/placement-groups.rst @@ -88,7 +88,10 @@ number of PGs that the pool is working towards, if a ``pg_num`` change is in progress). **NEW PG_NUM**, if present, is what the system believes the pool's ``pg_num`` should be changed to. It is always a power of 2, and will only be present if the "ideal" value -varies from the current value by more than a factor of 3. +varies from the current value by more than a factor of 3 by default. +This factor can be be adjusted with:: + + ceph config set mgr mgr/pg_autoscaler/threshold 2.0 **AUTOSCALE**, is the pool ``pg_autoscale_mode`` and will be either ``on``, ``off``, or ``warn``. diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index c57a5feb35dc..24487c7a3a3d 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -137,6 +137,14 @@ class PgAutoscaler(MgrModule): 'means starts out with full pgs and scales down when ' 'there is pressure '), runtime=True), + Option( + name='threshold', + type='float', + desc='scaling threshold', + long_desc=('The factor by which the `NEW PG_NUM` must vary from the current' + '`PG_NUM` before being accepted. Should not be less than 2.0'), + default=3.0, + min=2.0), ] def __init__(self, *args: Any, **kwargs: Any) -> None: @@ -151,6 +159,7 @@ class PgAutoscaler(MgrModule): self.autoscale_profile: 'ScaleModeT' = 'scale-up' self.sleep_interval = 60 self.mon_target_pg_per_osd = 0 + self.threshold = 3.0 def config_notify(self) -> None: for opt in self.NATIVE_OPTIONS: @@ -556,9 +565,9 @@ class PgAutoscaler(MgrModule): osdmap: OSDMap, pools: Dict[str, Dict[str, Any]], profile: 'ScaleModeT', - threshold: float = 3.0, ) -> Tuple[List[Dict[str, Any]], Dict[int, CrushSubtreeResourceStatus]]: + threshold = self.threshold assert threshold >= 2.0 crush_map = osdmap.get_crush()