Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class UniformLoadShedder implements LoadSheddingStrategy {

private static final Logger log = LoggerFactory.getLogger(UniformLoadShedder.class);

private static final double MB = 1024 * 1024;

private final Multimap<String, String> selectedBundlesCache = ArrayListMultimap.create();

/**
Expand All @@ -73,6 +75,9 @@ public Multimap<String, String> findBundlesForUnloading(final LoadData loadData,
MutableDouble maxThroughputRate = new MutableDouble(-1);
MutableDouble minMsgRate = new MutableDouble(Integer.MAX_VALUE);
MutableDouble minThroughputgRate = new MutableDouble(Integer.MAX_VALUE);

double minThroughputThreshold = conf.getLoadBalancerBundleUnloadMinThroughputThreshold() * MB;

brokersData.forEach((broker, data) -> {
double msgRate = data.getLocalData().getMsgRateIn() + data.getLocalData().getMsgRateOut();
double throughputRate = data.getLocalData().getMsgThroughputIn()
Expand Down Expand Up @@ -122,6 +127,15 @@ public Multimap<String, String> findBundlesForUnloading(final LoadData loadData,
(int) ((maxThroughputRate.getValue() - minThroughputgRate.getValue()) / 2));
LocalBrokerData overloadedBrokerData = brokersData.get(overloadedBroker.getValue()).getLocalData();

if (msgThroughtputRequiredFromUnloadedBundles.getValue() < minThroughputThreshold) {
if (log.isDebugEnabled()) {
log.debug("Planning to shed throughput {} MByte/s less than "
+ "minimumThroughputThreshold {} MByte/s, stop unload.",
msgThroughtputRequiredFromUnloadedBundles.getValue() / MB, minThroughputThreshold / MB);
}
return selectedBundlesCache;
}

if (overloadedBrokerData.getBundles().size() > 1) {
// Sort bundles by throughput, then pick the bundle which can help to reduce load uniformly with
// under-loaded broker
Expand Down