You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Aurelien Pernoud <ap...@sopragroup.com> on 2003/02/07 10:54:51 UTC

Moving to 2.0a2

Hi there, I'm finally beginning the big one (well in fact It doesn't seem
that long but one never knows !) for my project, moving from a nightly
(around may/02) to the 2.0a2.

I'd like your advice before starting it.
I'm using httpclient to get two distant servers communicate for my clients.

I was using a global httpclient that was handling request for every clients
(every request goes to same host), every client giving its state and its
method to execute. This gloal client was a rewrite of HttpMultiClient, to
allow using more connections than 2 per host (in my case, both servers are
intranet, and for this use only :)).
On my server A, when people log in, I give them a state they use to
"discuss" with server B. Then they ask the global httpclient to execute the
request, to be sure not to use too many connections at a time and get the
server B down.

So now that I'm looking the new httpclient, it seems this "hack" is not
necessary anymore. Here's how I see it :

- People log in on server A, I give them a personal State to discuss with
server B
- I'll use one global shared MultiThreadedConnectionManager for my project
for every clients on server A, and increasing it's maxconnectionsperhost.
- Each time I have a request to execute :
* I ask for a connection using the shared MultiThreadedConnectionManager
* I execute the method : method.execute(state of user, connection from
above)
* I don't have to release the connection, it's done (as far as I went into
the code, now a connection is associated to a manager, and call the
releaseconnection on it).

And it should work perfectly, whithout any hack to use more connections than
allowed !

Am I missing something, or is the way I see it the right way to use
httpclient (and the more evolutive of course) ?

Thx for your work and help, HttpClient is just perfect for my needs, and as
I saw it's performance were improved again (TCP_nodelay stuff), I want to
try the new one :)

Aurélien Pernoud


Re: Moving to 2.0a2

Posted by Michael Becke <be...@u.washington.edu>.
Sounds like a reasonable plan.  If you haven't already I would 
recommend looking at HttpClient.executeMethod().  It has a little bit 
of extra code for handling proxies and for opening the connection.  
Also, be sure to release the connections after you use them.  You can 
use either HttpMethod.releaseConnection() or 
HttpConnection.releaseConnection() to ensure each connection is 
released.

Good luck,

Mike

On Friday, February 7, 2003, at 04:54 AM, Aurelien Pernoud wrote:

>
> Hi there, I'm finally beginning the big one (well in fact It doesn't 
> seem
> that long but one never knows !) for my project, moving from a nightly
> (around may/02) to the 2.0a2.
>
> I'd like your advice before starting it.
> I'm using httpclient to get two distant servers communicate for my 
> clients.
>
> I was using a global httpclient that was handling request for every 
> clients
> (every request goes to same host), every client giving its state and 
> its
> method to execute. This gloal client was a rewrite of HttpMultiClient, 
> to
> allow using more connections than 2 per host (in my case, both servers 
> are
> intranet, and for this use only :)).
> On my server A, when people log in, I give them a state they use to
> "discuss" with server B. Then they ask the global httpclient to 
> execute the
> request, to be sure not to use too many connections at a time and get 
> the
> server B down.
>
> So now that I'm looking the new httpclient, it seems this "hack" is not
> necessary anymore. Here's how I see it :
>
> - People log in on server A, I give them a personal State to discuss 
> with
> server B
> - I'll use one global shared MultiThreadedConnectionManager for my 
> project
> for every clients on server A, and increasing it's 
> maxconnectionsperhost.
> - Each time I have a request to execute :
> * I ask for a connection using the shared 
> MultiThreadedConnectionManager
> * I execute the method : method.execute(state of user, connection from
> above)
> * I don't have to release the connection, it's done (as far as I went 
> into
> the code, now a connection is associated to a manager, and call the
> releaseconnection on it).
>
> And it should work perfectly, whithout any hack to use more 
> connections than
> allowed !
>
> Am I missing something, or is the way I see it the right way to use
> httpclient (and the more evolutive of course) ?
>
> Thx for your work and help, HttpClient is just perfect for my needs, 
> and as
> I saw it's performance were improved again (TCP_nodelay stuff), I want 
> to
> try the new one :)
>
> Aurélien Pernoud
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>