-
Notifications
You must be signed in to change notification settings - Fork 498
[FLINK-36836][Autoscaler] Supports config the upper and lower limits of target utilization #921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1996fanrui
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @huyuanfeng2018 for the PR.
Although it's just a draft PR, I checked the changes of AutoScalerOptions, something is unexpected from me. So I would give some feedbacks in advance.
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java
Outdated
Show resolved
Hide resolved
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java
Outdated
Show resolved
Hide resolved
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java
Outdated
Show resolved
Hide resolved
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java
Outdated
Show resolved
Hide resolved
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java
Outdated
Show resolved
Hide resolved
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java
Outdated
Show resolved
Hide resolved
4368ebe to
eba5b27
Compare
Thanks for the quick suggestion! I have made the suggested modifications and added the test case, PTAL. |
flink-autoscaler/src/test/java/org/apache/flink/autoscaler/ScalingExecutorTest.java
Show resolved
Hide resolved
flink-autoscaler/src/test/java/org/apache/flink/autoscaler/ScalingExecutorTest.java
Outdated
Show resolved
Hide resolved
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/ScalingMetricEvaluator.java
Show resolved
Hide resolved
...ator/src/test/java/org/apache/flink/kubernetes/operator/validation/DefaultValidatorTest.java
Outdated
Show resolved
Hide resolved
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/ScalingMetricEvaluator.java
Outdated
Show resolved
Hide resolved
02c01aa to
8907920
Compare
1996fanrui
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @huyuanfeng2018 for the update!
Overall LGTM, I only left 2 minor comments, please take a look in your free time, thanks~
...operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultValidator.java
Outdated
Show resolved
Hide resolved
...ator/src/test/java/org/apache/flink/kubernetes/operator/validation/DefaultValidatorTest.java
Outdated
Show resolved
Hide resolved
mxm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
| if (conf.getOptional(UTILIZATION_MAX).isPresent() | ||
| || conf.getOptional(UTILIZATION_MIN).isPresent() | ||
| || conf.getOptional(TARGET_UTILIZATION_BOUNDARY).isEmpty()) { | ||
| upperUtilization = conf.get(UTILIZATION_MAX); | ||
| lowerUtilization = conf.get(UTILIZATION_MIN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether the logic should be the following?
| if (conf.getOptional(UTILIZATION_MAX).isPresent() | |
| || conf.getOptional(UTILIZATION_MIN).isPresent() | |
| || conf.getOptional(TARGET_UTILIZATION_BOUNDARY).isEmpty()) { | |
| upperUtilization = conf.get(UTILIZATION_MAX); | |
| lowerUtilization = conf.get(UTILIZATION_MIN); | |
| if (conf.getOptional(UTILIZATION_MAX).isPresent() | |
| && conf.getOptional(UTILIZATION_MIN).isPresent()) { | |
| upperUtilization = conf.get(UTILIZATION_MAX); | |
| lowerUtilization = conf.get(UTILIZATION_MIN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think as long as one of UTILIZATION_MAX and UTILIZATION_MIN is set, it means that the user is already using the new config.
At the same time, if the user does not set TARGET_UTILIZATION_BOUNDARY, we still use the new config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not hard-code the defaults in the MIN_MAX options but it should be dynamically computed based on the target.
For example if the users sets target to 0.4 and min to 0.1, then it doesn't make sense to have the default max on 1.. Previously the boundary was 0.4 by default I think we should preserve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there is something wrong with my understanding:
Should we keep the boundary and then the max and min values are derived by boundary + target and target - boundary by default? Unless the user explicitly sets min max?
If that's the case, I think it's reasonable.
But in this case, should we change the min max parameter like to utilization.lower.boundary and utilization.upper.boundary ?
Then max = upper.boundary+ target , min = target- upper.boundary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @mxm suggested I think the logic should be enabled if either MIN or MAX is defined. If only one of them is defined then we can compute the default for the other one from the target utilization +- boundary.
I think we should not have default values for the min/max options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @mxm suggested I think the logic should be enabled if either MIN or MAX is defined
@gyfora Did you mean, if BOTH min and max are defined, the new logic should be enabled? If only one of them is defined, then we compute the other one using the configured target utilization and the boundary. I think that makes sense 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for not having static defaults for the new options because that would be confusing to users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public static final ConfigOption<Double> TARGET_UTILIZATION = | ||
| autoScalerConfig("target.utilization") | ||
| public static final ConfigOption<Double> UTILIZATION_TARGET = | ||
| autoScalerConfig("utilization.target") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to change this well-established key? This might confuse users, even though we have a fallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand its cleaner, but perhaps we can simply add the new keys and leave this unchanged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand its cleaner, but perhaps we can simply add the new keys and leave this unchanged?
Do we have to change this well-established key? This might confuse users, even though we have a fallback.
I think methed withFallbackKeys good enough
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the long term it's preferable to have consistent well named keys. I think the fallback keys should be enough. I would expect that users will gravitate towards the new min/max options and at that point this will make a lot of sense for everyone.
8907920 to
65c53e7
Compare
|
Thanks @1996fanrui @mxm review. Changes and replies have been made based on comments,PTAL. thanks~ |
1996fanrui
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @huyuanfeng2018 , thanks for the update!
I left 2 comments for the last commit, and they are related to #921 (comment) (Compatibility issues), please @gyfora and @mxm help double confirm, thanks a lot.
| public static final ConfigOption<Double> UTILIZATION_MAX = | ||
| autoScalerConfig("utilization.max") | ||
| .doubleType() | ||
| .noDefaultValue() | ||
| .withFallbackKeys(oldOperatorConfigKey("utilization.max")) | ||
| .withDescription("Max vertex utilization"); | ||
|
|
||
| public static final ConfigOption<Double> UTILIZATION_MIN = | ||
| autoScalerConfig("utilization.min") | ||
| .doubleType() | ||
| .noDefaultValue() | ||
| .withFallbackKeys(oldOperatorConfigKey("utilization.min")) | ||
| .withDescription("Min vertex utilization"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 options have no default value, I'm not sure whether it's expected.
If the target.utilization.boundary is removed in the future, how do we handle the default value?
Usually, when a new option is introduced, a default value is also designed. When deprecated options are removed in subsequent versions, we only need to remove unnecessary compatibility code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand, we will only keep the following three options in the end, and make it compatible with job.autoscaler.target.utilization.boundary before it is deprecated.
job.autoscaler.utilization.target
job.autoscaler.utilization.min
job.autoscaler.utilization.max
Do you mean we keep all 4 options in the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove the boundary at the end (deprecate now), but still min/max should not have fixed defaults as the default would be derived from the current target.
| public static final ConfigOption<Double> TARGET_UTILIZATION_BOUNDARY = | ||
| autoScalerConfig("target.utilization.boundary") | ||
| public static final ConfigOption<Double> UTILIZATION_TARGET_BOUNDARY = | ||
| autoScalerConfig("utilization.target.boundary") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is deprecated, do we need to add a @Deprecated annotation here?
Also, IIUC, we don't need to rename the option key name since it's deprecated. It means new users don't need it and we don't maintain it in the future. (Compatibility needs to be considered only in the short term.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If target.utilization.boundary will not be deprecated in the future,Is it reasonable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not rename this option also, the name you set is incorrect anyways. Keys should not be prefixes of each other (not yaml compliant)
|
Thanks @1996fanrui @gyfora for the reply Well, let me summarize our conclusion,
Then the logic for determining the default value of min/max is : now(boundary exist) : future(boundary remove) : I don’t know if there is anything wrong with my understanding. |
That sounds fully correct :) |
21bc13c to
e57f4b9
Compare
1996fanrui
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, LGTM assuming the CI is green.
Thanks for your quick reply |
…of target utilization
…ated by `utilization.target.boundary`
e57f4b9 to
08315cd
Compare
What is the purpose of the change
detail: FLINK-36836
Brief change log
job.autoscaler.utilization.minandjob.autoscaler.utilization.maxto determine the upper and lower limits of utilizationVerifying this change
job.autoscaler.target.utilization.boundarytojob.autoscaler.utilization.minandjob.autoscaler.utilization.maxScalingExecutorTest#testUtilizationBoundariesAndUtilizationMinMaxCompatibilityVerify compatibility of parameters before and afterDoes this pull request potentially affect one of the following parts:
CustomResourceDescriptors: (yes / no)Documentation