I'm using jetty client to make http2 connections with servers which are http2 enabled. I can see jetty opening conections as per need and utilise to exchange data between the endpoints. my snippet is as follows for creating http2 client,
Security.addProvider(new OpenSSLProvider());
SslContextFactory sslContextFactory = new SslContextFactory(true);
sslContextFactory.setProvider("Conscrypt");
sslContextFactory.setProtocol("TLSv1.3");
HTTP2Client http2Client = new HTTP2Client();
http2Client.setMaxConcurrentPushedStreams(1000);
http2Client.setConnectTimeout(30);
http2Client.setIdleTimeout(5);
HttpClient httpClient = new org.eclipse.jetty.client.HttpClient(new HttpClientTransportOverHTTP2(http2Client), sslContextFactory);
httpClient.setMaxConnectionsPerDestination(20);
httpClient.setMaxRequestsQueuedPerDestination(100);
httpClient.start();
httpClient.addBean(sslContextFactory);
httpClient.start();
and later on I use the above created client to exchange http2 requests like
Request request = httpClient.POST("my url goes here");
request.header(HttpHeader.CONTENT_TYPE, "application/json");
request.content(new StringContentProvider("xmlRequest PayLoad goes here","utf-8"));
ContentResponse response = request.send();
String res = new String(response.getContent());
My requirement is, there will 100s of requests multiplexed simultaneously to the same destination. its faster until the load is less but when the load starts increasing the time taken to process requests also starts increasing(sometime 10x).
In such a case I would like to force the jetty client to open multiple tcp connections and distribute the load to different sockets instead of squeezing everything to same opened socket. I have tried the below settings already with different values,
httpClient.setMaxConnectionsPerDestination(20);
httpClient.setMaxRequestsQueuedPerDestination(100);
with no luck.
Is jetty does connection coalescing when more than one connection is opened in jetty? is there a way to open multiple tcp connections and distribute the load so that the processing time is unaffected at the peak load time.
Jetty - 9.4.15, Provider - Conscypt, JDK - jdk.18, OS- Ubuntu/Centos
Thanks in advance