You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Andrea Fabris <ca...@email.it> on 2003/10/08 14:55:41 UTC

MultiThreadedHttpConnectionManager question

Hi everyone!
I'd like to ask some question about http pool in commons-httpclient.
As i read, MultiTrheadedHttpConnectionManager is the manger responsible for
handling the connection in a multi-thread enviroment.
I want to use this to create a private HttpClient property in a servlet
class, so each servlet thread can use a different socket to communicate with
a remote http server.
Now i monitored my enviroment to check the connection status and i found
that, when i don't use the servlet, some connection from servlet to remote
hosts remain up in CLOSE_WAIT state.
I want to ask you if this beahaviour is correct, because doing so the
manager uses machine resources even when there are no active requestes for
connection for a long time.
My enviroment is:
OS: linux redhat 8.2 with kernel 2.4.18
JVM: 1.3.1_07-b02
Tomcat 3.3.1
Commons-HttpClient 2.0rc1

Thanx for your help

Regards
Andrea Fabris
Sytel Reply - Italy




--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Conto Arancio. Zero spese, stessa banca, più interessi.
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=657&d=8-10

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: MultiThreadedHttpConnectionManager question

Posted by Michael Becke <be...@u.washington.edu>.
This definitely looks like the problem.  I think it's a little late to 
add this as a config option for 2.0, but should definitely be possible 
in head.  What do people think?

Mike

On Thursday, October 9, 2003, at 04:56 AM, Andrea Fabris wrote:

> I  took a look on the httpclient sourcecode and i noticed that in the
> HttpConnection.open() method the socket is not setted to use the 
> SO_LINGER
> value (as stated in th link forwarded by Odi).
> Have you tried to use it and maybe it causes some problems?
>
> Let me know
>
> Regards
> Andrea Fabris
> Sytel Reply
>
> On Thu, 09 Oct 2003 09:20:08 +0200 Ortwin [OGc] wrote:
>
>  OGc> It seems that this can be worked around by setting the SO_LINGER 
> time.
>  OGc> See this posting for details:
>  OGc>
>  OGc> http://www.geocrawler.com/archives/3/928/2000/5/0/3820105/
>  OGc>
>  OGc> Odi
>  OGc>
>  OGc> Michael Becke wrote:
>  ??>> Hi Andrea,
>  ??>>
>  ??>> The MultiThreadedHttpConnectionManager creates connections and 
> keeps
>  ??>> them open as long as it can.  The number of connections kept 
> open can
>  ??>> be configured using setMaxConnectionsPerHost() and
>  ??>> setMaxTotalConnections().  The issue of the sockets in the 
> CLOSE_WAIT
>  ??>> state seems to be a side effect of linux.  In particular it 
> seems to
>  ??>> keep sockets is this state even after the java.net.Socket has 
> been
>  ??>> closed.  I don't think there is much that can be done about it.
>  ??>>
>  ??>> Mike
>
>
>
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> Partecipa anche tu al progetto ShopMon: la Rete che fa bene
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1953&d=9-10
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: MultiThreadedHttpConnectionManager question

Posted by Andrea Fabris <ca...@email.it>.
I  took a look on the httpclient sourcecode and i noticed that in the
HttpConnection.open() method the socket is not setted to use the SO_LINGER
value (as stated in th link forwarded by Odi).
Have you tried to use it and maybe it causes some problems?

Let me know

Regards
Andrea Fabris
Sytel Reply

On Thu, 09 Oct 2003 09:20:08 +0200 Ortwin [OGc] wrote:

 OGc> It seems that this can be worked around by setting the SO_LINGER time.
 OGc> See this posting for details:
 OGc>
 OGc> http://www.geocrawler.com/archives/3/928/2000/5/0/3820105/
 OGc>
 OGc> Odi
 OGc>
 OGc> Michael Becke wrote:
 ??>> Hi Andrea,
 ??>>
 ??>> The MultiThreadedHttpConnectionManager creates connections and keeps
 ??>> them open as long as it can.  The number of connections kept open can
 ??>> be configured using setMaxConnectionsPerHost() and
 ??>> setMaxTotalConnections().  The issue of the sockets in the CLOSE_WAIT
 ??>> state seems to be a side effect of linux.  In particular it seems to
 ??>> keep sockets is this state even after the java.net.Socket has been
 ??>> closed.  I don't think there is much that can be done about it.
 ??>>
 ??>> Mike



--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Partecipa anche tu al progetto ShopMon: la Rete che fa bene
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1953&d=9-10

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: MultiThreadedHttpConnectionManager question

Posted by Ortwin Glück <or...@nose.ch>.
It seems that this can be worked around by setting the SO_LINGER time. 
See this posting for details:

http://www.geocrawler.com/archives/3/928/2000/5/0/3820105/

Odi

Michael Becke wrote:
> Hi Andrea,
> 
> The MultiThreadedHttpConnectionManager creates connections and keeps 
> them open as long as it can.  The number of connections kept open can be 
> configured using setMaxConnectionsPerHost() and 
> setMaxTotalConnections().  The issue of the sockets in the CLOSE_WAIT 
> state seems to be a side effect of linux.  In particular it seems to 
> keep sockets is this state even after the java.net.Socket has been 
> closed.  I don't think there is much that can be done about it.
> 
> Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: MultiThreadedHttpConnectionManager question

Posted by Michael Becke <be...@u.washington.edu>.
Hi Andrea,

The MultiThreadedHttpConnectionManager creates connections and keeps 
them open as long as it can.  The number of connections kept open can 
be configured using setMaxConnectionsPerHost() and 
setMaxTotalConnections().  The issue of the sockets in the CLOSE_WAIT 
state seems to be a side effect of linux.  In particular it seems to 
keep sockets is this state even after the java.net.Socket has been 
closed.  I don't think there is much that can be done about it.

Mike

On Wednesday, October 8, 2003, at 08:55 AM, Andrea Fabris wrote:

> Hi everyone!
> I'd like to ask some question about http pool in commons-httpclient.
> As i read, MultiTrheadedHttpConnectionManager is the manger 
> responsible for
> handling the connection in a multi-thread enviroment.
> I want to use this to create a private HttpClient property in a servlet
> class, so each servlet thread can use a different socket to 
> communicate with
> a remote http server.
> Now i monitored my enviroment to check the connection status and i 
> found
> that, when i don't use the servlet, some connection from servlet to 
> remote
> hosts remain up in CLOSE_WAIT state.
> I want to ask you if this beahaviour is correct, because doing so the
> manager uses machine resources even when there are no active requestes 
> for
> connection for a long time.
> My enviroment is:
> OS: linux redhat 8.2 with kernel 2.4.18
> JVM: 1.3.1_07-b02
> Tomcat 3.3.1
> Commons-HttpClient 2.0rc1
>
> Thanx for your help
>
> Regards
> Andrea Fabris
> Sytel Reply - Italy
>
>
>
>
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> Conto Arancio. Zero spese, stessa banca, più interessi.
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=657&d=8-10
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org