summaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-06-14 09:32:55 +0200
committerJon Marius Venstad <venstad@gmail.com>2021-06-14 09:33:09 +0200
commit2f8b1e849571ee0b224f8e2461238a7293569192 (patch)
treeea99dd6a758f9d27fc7d49403905241d2dfc62a4 /vespa-feed-client
parent165d2496f311d99846a9b3a821a2406341545c86 (diff)
One (single-conn) Jetty client per specified connection
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/JettyCluster.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/JettyCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/JettyCluster.java
index eb52c3f9e27..56be53798b1 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/JettyCluster.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/JettyCluster.java
@@ -28,7 +28,8 @@ class JettyCluster implements Cluster {
JettyCluster(FeedClientBuilder builder) {
for (URI endpoint : builder.endpoints)
- endpoints.add(new Endpoint(createJettyHttpClient(builder), endpoint));
+ for (int i = 0; i < builder.connectionsPerEndpoint; i++)
+ endpoints.add(new Endpoint(createJettyHttpClient(builder), endpoint));
}
private static HttpClient createJettyHttpClient(FeedClientBuilder builder) {
@@ -38,17 +39,13 @@ class JettyCluster implements Cluster {
clientSslCtxFactory.setHostnameVerifier(builder.hostnameVerifier);
HTTP2Client wrapped = new HTTP2Client();
- wrapped.setSelectors(8);
wrapped.setMaxConcurrentPushedStreams(builder.maxStreamsPerConnection);
HttpClientTransport transport = new HttpClientTransportOverHTTP2(wrapped);
HttpClient client = new HttpClient(transport, clientSslCtxFactory);
client.setUserAgentField(new HttpField("User-Agent", String.format("vespa-feed-client/%s", Vespa.VERSION)));
- client.setDefaultRequestContentType("application/json");
client.setFollowRedirects(false);
- client.setMaxRequestsQueuedPerDestination(builder.connectionsPerEndpoint * builder.maxStreamsPerConnection);
- client.setIdleTimeout(10000);
- client.setMaxConnectionsPerDestination(builder.connectionsPerEndpoint);
- client.setRequestBufferSize(1 << 16);
+ client.setMaxRequestsQueuedPerDestination(builder.maxStreamsPerConnection);
+ client.setMaxConnectionsPerDestination(1);
client.start();
return client;