Hi again,

sorry for pushing this, but these performance issues are about to become the 
show stopper for using Restlet in our application. 

We want to utilize the full features of HttpClient by using a connection pool 
and persistent connections. Here is the code how I configure HttpClient for 
restlet:

Context restletContext = new Context();         
restletContext.getParameters().set("maxTotalConnections", "16");                
restletContext.getParameters().set("maxConnectionsPerHost", "8");

Then client resources are created like this:

ClientResource cr = new ClientResource(restletContext, uri);

However, each client resource instantiation spawns a new Http Client instead of 
reusing available instances. This tremendously slows down our application. And 
I can't reuse client resource as long as they are not threadsafe.

On stackoverflow, I read the hint that I might spawn my own Client instance and 
add it to the client resource using 

Client client = new Client(restletContext, Protocol.HTTP);
cr.setNext(client);

But as soon as the number of calls increases, this starts to throw NPEs so this 
also might not be the right solution.

Is there any way to instantiate the underlying HttpClient instance by myself 
and then attach it as the Restlet client? 

To sum it up, I'd like to use the nice abstractions and features of Restlet 
while still being able to use the full power of a HttpClient with a 
ThreadSafeClientConnManager. If I can't get to work the latter, I'll have to 
fall back to HttpClient alone and do the low level stuff on my own, which would 
make Restlet unfortunately obsolete for this use case.

So thanks in advance for help or any hints!

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2643825

Reply via email to