summaryrefslogtreecommitdiffstats
path: root/messagebus
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2020-12-02 13:12:51 +0100
committerGitHub <noreply@github.com>2020-12-02 13:12:51 +0100
commitafd9fcab275450eb6c97c30f99662a2fce4382fa (patch)
tree1fcc9a4e1d9fc21399500c6c07d2b9586e8cd062 /messagebus
parentab89448992a6aae83c8daaffac9486ed48e88e65 (diff)
parentb38ce2dd957fa3fd4ddd86a7564a4cd095fdb06f (diff)
Merge pull request #15579 from vespa-engine/jonmv/floating-point-window-size
Jonmv/floating point window size
Diffstat (limited to 'messagebus')
-rw-r--r--messagebus/src/main/java/com/yahoo/messagebus/DynamicThrottlePolicy.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/DynamicThrottlePolicy.java b/messagebus/src/main/java/com/yahoo/messagebus/DynamicThrottlePolicy.java
index 1cfbefae29b..93c63112b46 100644
--- a/messagebus/src/main/java/com/yahoo/messagebus/DynamicThrottlePolicy.java
+++ b/messagebus/src/main/java/com/yahoo/messagebus/DynamicThrottlePolicy.java
@@ -76,7 +76,9 @@ public class DynamicThrottlePolicy extends StaticThrottlePolicy {
windowSize = Math.min(windowSize, pendingCount + windowSizeIncrement);
}
timeOfLastMessage = time;
- return pendingCount < windowSize;
+ int windowSizeFloored = (int) windowSize;
+ boolean carry = numSent < (windowSize * resizeRate) * windowSize - windowSizeFloored;
+ return pendingCount < windowSizeFloored + (carry ? 1 : 0);
}
@Override
@@ -97,7 +99,7 @@ public class DynamicThrottlePolicy extends StaticThrottlePolicy {
if (maxThroughput > 0 && throughput > maxThroughput * 0.95) {
// No need to increase window when we're this close to max.
- } else if (throughput > localMaxThroughput * 1.01) {
+ } else if (throughput >= localMaxThroughput) {
localMaxThroughput = throughput;
windowSize += weight*windowSizeIncrement;
if (log.isLoggable(Level.FINE)) {
@@ -200,13 +202,13 @@ public class DynamicThrottlePolicy extends StaticThrottlePolicy {
/**
* Sets the weight for this client. The larger the value, the more resources
* will be allocated to this clients. Resources are shared between clients
- * proportiannally to their weights.
+ * proportionally to the set weights.
*
* @param weight the weight to set
* @return this, to allow chaining
*/
public DynamicThrottlePolicy setWeight(double weight) {
- this.weight = weight;
+ this.weight = Math.pow(weight, 0.5);
return this;
}