summaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2023-09-11 17:03:04 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2023-09-12 08:57:46 +0200
commitebb067302935c8676987d62b99af725f95149db8 (patch)
tree7624466c90631556ff1985a3f80a7fd682eb5501 /vespa-feed-client
parentf7564626e5dc7159c117de7a11afe57f4b054ad7 (diff)
Ensure connections are cycled regularly when using secure HTTP/2 tunnel
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java
index 3a5c98ca27c..e4e6fbe752e 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java
@@ -140,7 +140,9 @@ class JettyCluster implements Cluster {
connector.setExecutor(new QueuedThreadPool(threads));
connector.setSslContextFactory(clientSslCtxFactory);
connector.setIdleTimeout(IDLE_TIMEOUT);
- connector.setConnectTimeout(Duration.ofSeconds(30));
+ boolean secureProxy = b.proxy != null && b.proxy.getScheme().equals("https");
+ // Increase connect timeout for secure HTTP/2 proxy
+ connector.setConnectTimeout(Duration.ofSeconds(secureProxy ? 120 : 30));
HTTP2Client h2Client = new HTTP2Client(connector);
h2Client.setMaxConcurrentPushedStreams(b.maxStreamsPerConnection);
// Set the HTTP/2 flow control windows very large to cause TCP congestion instead of HTTP/2 flow control congestion.
@@ -156,6 +158,8 @@ class JettyCluster implements Cluster {
MultiplexConnectionPool pool = new MultiplexConnectionPool(
dest, Pool.StrategyType.RANDOM, connectionsPerEndpoint, false, dest, Integer.MAX_VALUE);
pool.preCreateConnections(connectionsPerEndpoint);
+ if (secureProxy) pool.setMaxDuration(Duration.ofMinutes(1).toMillis());
+ else pool.setMaximizeConnections(true);
return pool;
});
HttpClient httpClient = new HttpClient(transport);