Skip to content
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

Merged
merged 1 commit into from
Feb 23, 2022
Merged

Conversation

qmhu
Copy link
Member

@qmhu qmhu commented Feb 23, 2022

No description provided.

@@ -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)
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor

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

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)
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@mfanjie
Copy link
Contributor

mfanjie commented Feb 23, 2022

/lgtm

@mfanjie mfanjie merged commit eeae80b into gocrane:main Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants