Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Query on Max Requests Per connection

Hi Team,

I am doing POC on http2 using jetty libraries. As per my requirement i have to send json string as payload to server using http2 client,below is  my code snippet,one thing i observed that in one http connection it sends max 1024 requests,and also some times it handles 500 requests in one connection.

 After reaching max value,jetty API does not give any indication saying maximum requests for the opened connection is reached,so how do we know at what point we have to create new connection to send the remaining requests.

Please help.

        HTTP2Client http2Client = new HTTP2Client();
        http2Client.start();

        SslContextFactory ssl = new SslContextFactory(true);
        ssl.setKeyStore(getKeyStore());
        ssl.setKeyStorePassword("");

        HttpClient client = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), ssl);
        client.start();

        for (int i = 0; i < 2000; i++) {

 HttpDestinationOverHTTP2 httpDestinationOverHTTP2 = (HttpDestinationOverHTTP2) client
                        .getDestinations().get(0);

System.out.println("Max requests per connection"+httpDestinationOverHTTP2.getMaxRequestsPerConnection());

            Request req = client
                    .POST("https://www.test.com")
                  
                    .path("/test")

                    .content(
                            new StringContentProvider(
                                    "{ "Test" } }"));

            req.send(new ResponseListener(i));
        }



Back to the top