diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-06-01 21:57:29 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-06-01 21:57:29 +0200 |
commit | 951b86bbe849fdf81aa25a917d4157c9cf52d173 (patch) | |
tree | d0336ceb219d2483f70feb4f4fe8f940f3230006 /vespa-feed-client/src | |
parent | f681e9933cc8d9c3e0470e0eede56eb9ffdee296 (diff) |
Add back target inflight increase on success
Diffstat (limited to 'vespa-feed-client/src')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/FeedClient.java | 2 | ||||
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java | 7 |
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); } } |