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

core: outlier detection max ejection logic update #9492

Merged
merged 1 commit into from Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions core/src/main/java/io/grpc/util/OutlierDetectionLoadBalancer.java
Expand Up @@ -733,10 +733,11 @@ public void ejectOutliers(AddressTrackerMap trackerMap, long ejectionTimeNanos)
mean - stdev * (config.successRateEjection.stdevFactor / 1000f);

for (AddressTracker tracker : trackersWithVolume) {
// If we are above the max ejection percentage, don't eject any more. This will allow the
// total ejections to go one above the max, but at the same time it assures at least one
// ejection, which the spec calls for. This behavior matches what Envoy proxy does.
if (trackerMap.ejectionPercentage() > config.maxEjectionPercent) {
// If we are above or equal to the max ejection percentage, don't eject any more. This will
// allow the total ejections to go one above the max, but at the same time it assures at
// least one ejection, which the spec calls for. This behavior matches what Envoy proxy
// does.
if (trackerMap.ejectionPercentage() >= config.maxEjectionPercent) {
return;
}

Expand Down Expand Up @@ -797,10 +798,11 @@ public void ejectOutliers(AddressTrackerMap trackerMap, long ejectionTimeNanos)

// If this address does not have enough volume to be considered, skip to the next one.
for (AddressTracker tracker : trackersWithVolume) {
// If we are above the max ejection percentage, don't eject any more. This will allow the
// total ejections to go one above the max, but at the same time it assures at least one
// ejection, which the spec calls for. This behavior matches what Envoy proxy does.
if (trackerMap.ejectionPercentage() > config.maxEjectionPercent) {
// If we are above or equal to the max ejection percentage, don't eject any more. This will
// allow the total ejections to go one above the max, but at the same time it assures at
// least one ejection, which the spec calls for. This behavior matches what Envoy proxy
// does.
if (trackerMap.ejectionPercentage() >= config.maxEjectionPercent) {
return;
}

Expand Down
Expand Up @@ -585,7 +585,7 @@ public void successRateTwoOutliers() {
@Test
public void successRateThreeOutliers_maxEjectionPercentage() {
OutlierDetectionLoadBalancerConfig config = new OutlierDetectionLoadBalancerConfig.Builder()
.setMaxEjectionPercent(20)
.setMaxEjectionPercent(30)
.setSuccessRateEjection(
new SuccessRateEjection.Builder()
.setMinimumHosts(3)
Expand Down