maxConnectionsPerHost and maxTotalConnections

classic Classic list List threaded Threaded
1 message Options
Max
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

maxConnectionsPerHost and maxTotalConnections

Max

Hello,

We have in our Restlet application a server resource that simply passes on the results of the requests made to another server with a ClientResource. This last server being always the same.

That was working fine with Restlet 2.1.6.

We recently updated Restlet to 2.3.7. Since then, after a few days (around 2 or 3) the ClientResource always fails with a 1001 status because of a request timeout.

I found in https://restlet.com/technical-resources/restlet-framework/misc/2.3/changes :

(quote)

- 2.3 Milestone 4 (10/31/2014)
    - Enhancements
      - Unified the HTTP client connector parameters (socket connection to 15s,
        idle socket to 60s, socket stop to 60s, max connections per host to 10,
        max total connections to 20). Suggested by Kristoffer Gronowski.
(end quote)

that is in https://restlet.com/technical-resources/restlet-framework/javadocs/snapshot/jse/ext/index.html?org/restlet/ext/httpclient/HttpClientHelper.html :

maxConnectionsPerHost    int    10    The maximum number of connections that will be created for any particular host.
maxTotalConnections         int    20    (uses HttpClient's default) The maximum number of active connections.

I also found out that these parameters were at a value of "-1" (infinite, I suppose) before.

Could this be the cause of our problem?

Could the following code fix it?

private static final Context CONTEXT = new Context();
   
static {
    CONTEXT.getParameters().set("maxConnectionsPerHost", "-1");
    CONTEXT.getParameters().set("maxTotalConnections", "-1");
}

// Constructing the client resources with CONTEXT

Thank you very much for your answer.

Best regards,

--
--
NeoDoc
Maxime Bégnis
[hidden email]
Tél: +33 (0)4.42.52.24.20
789 Rue de La Gare
13770 Venelles
France

--
You received this message because you are subscribed to the Google Groups "Restlet Framework (Discuss)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Loading...