-
Notifications
You must be signed in to change notification settings - Fork 386
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
Don't predict memory in effective hpa #148
Conversation
pkg/recommend/advisor/ehpa.go
Outdated
@@ -96,11 +96,11 @@ func (a *EHPAAdvisor) Advise(proposed *types.ProposedRecommendation) error { | |||
targetCpuUtilization := int32(50) // todo: configurable | |||
maxReplicasFactor := 1.2 // todo: configurable | |||
|
|||
maxCpuUtilization := int32(int64(maxCpuUsage) * 1000 * 100 / requestTotal) | |||
maxCpuUtilization := int32(int64(maxCpuUsage) * 1000 * 100 * int64(len(a.Pods)) / requestTotal) |
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.
why multiply pods num. maxCpuUsage is average max usage of each pod? I see it is computed only by one timeseries tsList[0], not all
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.
requestTotal contains total request for workload, so we need to add 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.
maxCpuUsage is max of workload‘s(sum of all pods) usage too, so the original code is right, do not need fix
pkg/recommend/advisor/ehpa.go
Outdated
proposedMaxRatio := float64(maxCpuUtilization) / float64(targetCpuUtilization) | ||
maxReplicasProposed := int32(math.Ceil(proposedMaxRatio * float64(a.ReadyPodNumber) * maxReplicasFactor)) | ||
|
||
minCpuUtilization := int32(int64(minCpuUsage) * 1000 * 100 / requestTotal) | ||
minCpuUtilization := int32(int64(minCpuUsage) * 1000 * 100 * int64(len(a.Pods)) / requestTotal) |
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.
same fuzzing as above
@@ -189,7 +189,7 @@ func (c *EffectiveHPAController) GetHPAMetrics(ctx context.Context, ehpa *autosc | |||
if metric.Type == autoscalingv2.ResourceMetricSourceType { | |||
name, err := GetPredictionMetricName(metric.Resource.Name) | |||
if err != nil { | |||
return nil, err | |||
continue |
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.
log error, suggest not make it silent
@@ -131,7 +131,7 @@ func (c *EffectiveHPAController) NewPredictionObject(ehpa *autoscalingapi.Effect | |||
if metric.Type == autoscalingv2.ResourceMetricSourceType { | |||
metricName, err := GetPredictionMetricName(metric.Resource.Name) | |||
if err != nil { | |||
return nil, err | |||
continue |
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.
same as above
19c05aa
to
31f356a
Compare
/lgtm |
No description provided.