summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-06-01 21:57:29 +0200
committerJon Marius Venstad <venstad@gmail.com>2021-06-01 21:57:29 +0200
commit951b86bbe849fdf81aa25a917d4157c9cf52d173 (patch)
treed0336ceb219d2483f70feb4f4fe8f940f3230006
parentf681e9933cc8d9c3e0470e0eede56eb9ffdee296 (diff)
Add back target inflight increase on success
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/FeedClient.java2
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java7
2 files changed, 5 insertions, 4 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/FeedClient.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/FeedClient.java
index 1b616a70da9..455a79060ee 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/FeedClient.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/FeedClient.java
@@ -20,7 +20,7 @@ public interface FeedClient extends Closeable {
default boolean retry(OperationType type) { return true; }
/** Number of retries per operation for non-backpressure problems. */
- default int retries() { return 5; }
+ default int retries() { return 32; }
}
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
index 17edfeafba6..d43edc9656b 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
@@ -14,6 +14,7 @@ import java.util.function.BiConsumer;
import java.util.logging.Logger;
import static java.lang.Math.max;
+import static java.lang.Math.min;
import static java.util.logging.Level.INFO;
/**
@@ -45,16 +46,15 @@ class HttpRequestStrategy implements RequestStrategy {
HttpRequestStrategy(FeedClientBuilder builder) {
this.wrapped = builder.retryStrategy;
this.maxInflight = builder.maxConnections * (long) builder.maxStreamsPerConnection;
- this.minInflight = builder.maxConnections * (long) Math.min(16, builder.maxStreamsPerConnection);
+ this.minInflight = builder.maxConnections * (long) min(16, builder.maxStreamsPerConnection);
this.targetInflight = Math.sqrt(maxInflight) * (Math.sqrt(minInflight));
}
private boolean retry(SimpleHttpRequest request, int attempt) {
if (attempt >= wrapped.retries())
return false;
-
- switch (request.getMethod().toUpperCase()) {
+ switch (request.getMethod().toUpperCase()) {
case "POST": return wrapped.retry(FeedClient.OperationType.put);
case "PUT": return wrapped.retry(FeedClient.OperationType.update);
case "DELETE": return wrapped.retry(FeedClient.OperationType.remove);
@@ -81,6 +81,7 @@ class HttpRequestStrategy implements RequestStrategy {
synchronized (lock) {
++consecutiveSuccesses;
lastSuccess = now;
+ targetInflight = min(targetInflight + 0.1, maxInflight);
}
}