diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-09-11 10:27:26 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-09-11 10:27:26 +0200 |
commit | 87cad1667fba337aa7e228a6ac092fcb82911222 (patch) | |
tree | 252cee4df5acd5042ae0997bc66e9b53b8e31cc5 | |
parent | ada20858e7f2f3ea6e6c8b28ad7ff3da862e4f7c (diff) |
Reduce max inflight requests to respect streams per connection
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/StaticThrottler.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/StaticThrottler.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/StaticThrottler.java index 1f9cf8e5155..4190bd1f580 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/StaticThrottler.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/StaticThrottler.java @@ -21,8 +21,10 @@ public class StaticThrottler implements Throttler { private final AtomicLong targetX10; public StaticThrottler(FeedClientBuilderImpl builder) { - minInflight = 16L * builder.connectionsPerEndpoint * builder.endpoints.size(); - maxInflight = 256 * minInflight; // 4096 max streams per connection on the server side. + minInflight = 4L * builder.connectionsPerEndpoint * builder.endpoints.size(); + // Add 1 to buffer some extra requests + maxInflight = Math.min(builder.maxStreamsPerConnection + 1L, 512) + * (builder.connectionsPerEndpoint + 1L) * (long)builder.endpoints.size(); targetX10 = new AtomicLong(10 * maxInflight); // 10x the actual value to allow for smaller updates. } |