Modified proposal for configurable HPA to use a single field to specify allowed changes#1234
Conversation
|
Welcome @arjunrn! |
|
Hi @arjunrn. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/assign @mwielgus |
|
/assign @josephburnett |
| previous recommendations to prevent flapping of the number of replicas. | ||
| - `scaleUp` specifies the rules which are used to control scaling behavior while scaling up | ||
| - `periodSecond` the amount of time in seconds for which the rule should hold true. | ||
| - `maxAllowedChanged` the maximum allowed changed in replicas in the given period. Can be an absolute |
There was a problem hiding this comment.
I find it confusing to use a single field for both absolute and percentage values. How will you tell the difference? Is 0.5 a percentage or absolute value?
What about something more along the lines of @thockin's suggestion of having "Pods" and "Percent" policies?
constraints:
scaleUp: # allow the max of 3 pods or 100% to be added every 15 seconds
- policy: Pods
value: 3
periodSeconds: 15
- policy: Percent
value: 100
periodSeconds: 15
scaleDown: # allow the max of 2 pods or 20% to be removed every 15 seconds
- policy: Pods
value: 2
periodSeconds: 15
- policy: Percent
value: 20
periodSeconds: 15
stabilizationWindowSeconds: 120 # downscale stabilization window of 2 minutesNote: I changed the scaleDown field to be a list of policies so you can specify both Pods and Percent. This would be useful for:
- getting the autoscaler off the ground (i.e. allowing increase of 1->4, but still limiting to 200%)
- allowing for future policy (I don't know what).
There was a problem hiding this comment.
I thought about this and the reason I went with a single value is because there is precedent for this as suggested by @liggitt here. Also the deployment controller currently uses the same type of value to specify increase in number of pods. Also there are already many hidden levers in the HPA controller which makes it harder for end-users to predict or analyze HPA behavior. Having a single value reduces the thinking you need to do when there are multiple policies.
Having multiple policies would make the HPA more flexible but at the moment I don't see the real need for it other than the use case of going from 1 -> 4 pods. Nor do I know if any type of workload which would need behavior like this. Also since we are going to split the code paths I don't think there is a need to preserve the old behavior, especially since it's not documented. As for a value like "0.5" we could look into how it is treated in the deployment controller.
That said if the maintainers think that multiple policies is the way to go then I will modify the proposal.
There was a problem hiding this comment.
There are examples of policy lists in the autoscaling space, such as MetricSource.
Given that this will live in the same resource (HPA) as MetricTarget, I would prefer to follow that pattern over the Deployment pattern. I see your point about a single value being easier to understand, but I would prefer flexibility in this case.
I don't see the real need for it
A hypothetical example: what if there were a new policy which limits the core-hours used per day? A sort of "cost" constraint.
constraints:
scaleUp:
- policy: Cost
cpuCoresHours: 240 # 10 cores per day on average
periodSeconds: 86400 # budgeted over a 24 hour windowWe don't have to design it now. But I would like to avoid an autoscaling v2beta3 by leaving space for it. 🤞
aee4b6c to
a5d553c
Compare
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
a5d553c to
b2a7ab6
Compare
|
As discussed with @josephburnett I have updated the KEP so that multiple policies can be specified for scaling behavior. But default the highest change is chosen but this can be changed by specified a value for |
josephburnett
left a comment
There was a problem hiding this comment.
We should also add some graduation criteria.
keps/sig-autoscaling/20190307-configurable-scale-velocity-for-hpa.md
Outdated
Show resolved
Hide resolved
Additionally, fixed some typos and added one more use case why the stabilizationWindowSeconds in the scaleUp section might be useful
Put stabilizationWindowSeconds in the scaleUp/scaleDown section
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
| ```yaml | ||
| behavior: | ||
| scaleUp: | ||
| stabilizationWindowSeconds: 300 |
There was a problem hiding this comment.
Well, originally, I named it "delay".
Though, it might be useful to show that we "stabilize recommendations". So it is not "just delay", it is "delay, and then react given previous recommendations".
So, "stabilization" does make sense.
I'm ok with any name, to be honest. :)
There was a problem hiding this comment.
delay kind of implies it's a one time thing. stabilizationWindow would be more appropriate considering it's a moving window in which previous recommendations are considered to stabilize the scaling. I will explain this when I update the documentation for this feature.
keps/sig-autoscaling/20190307-configurable-scale-velocity-for-hpa.md
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| type HPAScalingRules struct { | ||
| StabilizationWindowSeconds *int32 |
There was a problem hiding this comment.
I think we were going to add Tolerance, even if it's just in the KEP and not implemented yet.
There was a problem hiding this comment.
In the non-goals I mention tolerance as one of the non-goals.
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
|
/lgtm |
|
/assign @mwielgus |
| creation-date: 2019-03-07 | ||
| last-updated: 2019-03-07 | ||
| last-updated: 2019-09-16 | ||
| status: provisional |
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: arjunrn, josephburnett, mwielgus The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I have update the proposal with changes to make the configurable scaling behavior more intuitive and in line with suggestions received during when this proposal was initial made #853
The changes I have made are:
Remove theThedelaySecondsoptions for scale down and scale up. This option is mean to prevent flapping of the replicas. But as suggested in the original PR this is a stabilization feature and I have changed the name to indicate this. I also believe there is no reason anyone would want to stabilize while scaling up. In fact this is non-intuitive because it looks similar to theperiodSecondsuse to specify the scaling rules. So now there is only one place where thestabilizationWindowcan be specified and it is at the same level as the scale up and scale down behavior.delaySecondsfield has been renamed tostabilizationWindowSeconds.constraintsfield tobehaviorbecause this configuration specifies how scaling behaves. And also it could be used in the future to specify other aspects of scaling like the tolerances.Instead of specifying aThepodandpercentfields for scaling I have changed it to a single field calledmaxAllowedChange. This is similar tomaxSurgeandmaxUnavailablein a deployment where the value is percent or absolute number of pods. I believe this more intuitive than have 2 fields and one of the values being chosen based on which one is higher at a certain point of time.podandpercentchanges can be specified as a list of policies and the user can specify which policy will be selected based on evaluation at runtime.Note: There is one downside to the new scheme. It cannot replicate the current scale up behavior because the current behavior adds 4 pods if there are less than 4 pods and 100% of the pods after that. This behavior is currently unspecified in the documentation and probably nobody relies on it. Also this behavior will only change if the user explicitly uses the new
behaviorfield.