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
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pkg/ensurance/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (s *AnomalyAnalyzer) computeActionContext(aboveThreshold bool, key string,
s.restored[key] = uint64(object.RestoreThreshold)
}
// only do restore action after trigger x times and restore y times
if s.triggered[key] >= uint64(object.AvoidanceThreshold) &&
if (s.triggered[key] >= uint64(object.AvoidanceThreshold) || s.triggered[key] == 0) &&
s.restored[key] >= uint64(object.RestoreThreshold) {
// reset trigger count when restored
s.triggered[key] = 0
Expand Down
20 changes: 9 additions & 11 deletions pkg/ensurance/executor/watermark.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,21 +215,19 @@ 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 {
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.

// Wrong case: throttleUpExist && throttleDownExist won't co-exist
klog.Warningf("throttleUpExist && throttleDownExist won't co-exist: For metrics %s, maxUsed is %f, watermark is %f", m.Name, maxUsed, float64(throttleDownWatermark.PopSmallest().Value()))
continue
} 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()))
}

// If metric not exist in ThrottleUpWatermark, throttleUpGapToWatermarks of metric will can't be calculated
if !throttleUpExist {
delete(result, m.Name)
} else {
} 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)
result[m.Name] = (1 - executeExcessPercent) * (float64(throttleUpWatermark.PopSmallest().Value()) - maxUsed)
} else {
delete(result, m.Name)
}
}
}
Expand Down