Skip to content

Commit

Permalink
Use direct memory instead of Heap to determine a broker is "overloade…
Browse files Browse the repository at this point in the history
…d" in memory usage (apache#3199)
  • Loading branch information
merlimat authored Dec 16, 2018
1 parent 41e8e66 commit e2408ef
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public ZooKeeperChildrenCache getActiveBrokersCache() {
public Set<String> getAvailableBrokers() throws Exception {
return this.availableActiveBrokers.get();
}

public ZooKeeperDataCache<LoadReport> getLoadReportCache() {
return this.loadReportCacheZk;
}
Expand Down Expand Up @@ -1062,13 +1062,15 @@ private void updateRanking() {
public static boolean isAboveLoadLevel(SystemResourceUsage usage, float thresholdPercentage) {
return (usage.bandwidthOut.percentUsage() > thresholdPercentage
|| usage.bandwidthIn.percentUsage() > thresholdPercentage
|| usage.cpu.percentUsage() > thresholdPercentage || usage.memory.percentUsage() > thresholdPercentage);
|| usage.cpu.percentUsage() > thresholdPercentage
|| usage.directMemory.percentUsage() > thresholdPercentage);
}

public static boolean isBelowLoadLevel(SystemResourceUsage usage, float thresholdPercentage) {
return (usage.bandwidthOut.percentUsage() < thresholdPercentage
&& usage.bandwidthIn.percentUsage() < thresholdPercentage
&& usage.cpu.percentUsage() < thresholdPercentage && usage.memory.percentUsage() < thresholdPercentage);
&& usage.cpu.percentUsage() < thresholdPercentage
&& usage.directMemory.percentUsage() < thresholdPercentage);
}

private static long getRealtimeJvmHeapUsageMBytes() {
Expand Down

0 comments on commit e2408ef

Please sign in to comment.