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

throttle not happen when cpu-usage exceed nodeqos threshhold #659

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pkg/ensurance/executor/watermark.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,21 +215,21 @@ func calculateGaps(stateMap map[string][]common.TimeSeries,
throttleDownWatermark, throttleDownExist := throttleExecutor.ThrottleDownWatermark[m.Name]
throttleUpWatermark, throttleUpExist := throttleExecutor.ThrottleUpWatermark[m.Name]

// If a metric does not exist in ThrottleDownWatermark, throttleDownGapToWatermarks of this metric will can't be calculated
if !throttleDownExist {
delete(result, m.Name)
} else {
klog.V(6).Infof("BuildThrottleDownWatermarkGap: For metrics %s, maxUsed is %f, watermark is %f", m.Name, maxUsed, float64(throttleDownWatermark.PopSmallest().Value()))
if throttleDownExist && throttleUpExist {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be deleted, throttleDownExist and throttleUpExist can't co-exist.

klog.V(6).Infof("BuildThrottleDownWatermarkGap & BuildThrottleUpWatermarkGap: For metrics %s, maxUsed is %f, watermark is %f", m.Name, maxUsed, float64(throttleDownWatermark.PopSmallest().Value()))
result[m.Name] = (1 + executeExcessPercent) * (maxUsed - float64(throttleDownWatermark.PopSmallest().Value()))
}

// If metric not exist in ThrottleUpWatermark, throttleUpGapToWatermarks of metric will can't be calculated
if !throttleUpExist {
delete(result, m.Name)
} else {
// Attention: different with throttleDown and evict, use watermark - used
result[m.Name] = (1 + executeExcessPercent) * (float64(throttleUpWatermark.PopSmallest().Value()) - maxUsed)
Copy link
Contributor

Choose a reason for hiding this comment

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

And you can find result[m.Name] been assigned twice.

} else if throttleDownExist {
klog.V(6).Infof("BuildThrottleDownWatermarkGap: For metrics %s, maxUsed is %f, watermark is %f", m.Name, maxUsed, float64(throttleDownWatermark.PopSmallest().Value()))
result[m.Name] = (1 + executeExcessPercent) * (maxUsed - float64(throttleDownWatermark.PopSmallest().Value()))
} else if throttleUpExist {
klog.V(6).Infof("BuildThrottleUpWatermarkGap: For metrics %s, maxUsed is %f, watermark is %f", m.Name, maxUsed, float64(throttleUpWatermark.PopSmallest().Value()))
// Attention: different with throttleDown and evict, use watermark - used
result[m.Name] = (1 + executeExcessPercent) * (float64(throttleUpWatermark.PopSmallest().Value()) - maxUsed)
} else {
delete(result, m.Name)
}
}
}
Expand Down