Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Help on Connection Management

I am doing POC on jetty high level http2 client,i am using jetty version 9.3.7.v20160115. Below is my code snippet.

I am facing issue with jetty high level API on connection management.
Let say i have to post 100000 requests to destination url by fetching data from db one by one,Default value of  MaxRequestsQueuedPerDestination in HttpClient is 1024, it means one connection can  handle only 1024 requests,after processing  1024 requests do we have to create new connection for processing remaining requests ? or is there any way handle connections? And also Please explain what is reason behind allowing only 1024 requests per connection?  

 public class Test{

             public static void main(String args[]){

                ALPN.debug = true;
        HTTP2Client http2Client = new HTTP2Client();
        SslContextFactory ssl = new SslContextFactory(true);
        HttpClient client = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), ssl);

    System.out.println("-----Max request per destination"
+ client.getMaxRequestsQueuedPerDestination());
+ client.getMaxRequestsQueuedPerDestination());
        long start =System.currentTimeMillis();    

        req.send(new ResponseListener(i)); 


//Response is handled asynchronously.

public class ResponseListener extends BufferingResponseListener{
    int id = 0;
    int j = 0;

    private String threadName;

    public ResponseListener(int i) {
        id = i;

    public void onComplete(Result result) {
        try {

            Response response = result.getResponse();
            //System.out.println("Response .." + response);
            int status = response.getStatus();
            if (status == 200) {
                System.out.println("ID-" + id + ",Success");
            else {
                System.out.println("ID-" + id + ",Failure. status code " + status + ", response"
                        + getContentAsString());
        catch (Throwable t) {



Back to the top