You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Michael <mi...@gmail.com> on 2009/05/06 14:33:07 UTC

MultiThreadedHttpConnectionManager: How many threads?

Hello,

I am using version 3.1 and currently have some problems regarding thread
management.

$Header:
/home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
1.47 2004/12/21 11:27:55 olegk Exp $

>From the code I would guess that I should not end up having more than

HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setMaxTotalConnections(...)

Threads called "Timeout Guard" flying around in my JVM. Unfortunately I
limited it to 15 connections in total and find around 25 of those threads at
times. On my kind of limited virtual server that is currently  causing some
problems.

I would appreciate some help. Thanks in advance...

Regards
 Michael

Re: MultiThreadedHttpConnectionManager: How many threads?

Posted by Oleg Kalnichevski <ol...@apache.org>.
Michael wrote:
> Hi Oleg,
> 
> I am using
> 
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> 

I find this suspicious as TimeoutController is used only when running on 
pre 1.4 JREs.

(1) double-check the server side environment and make sure the correct 
JRE gets picked up.
(2) replace DefaultProtocolSocketFactory with a custom impl that uses 
Java 1.4 methods for controlling connect timeouts.

Hope this helps

Oleg


> I think I am seeing the threads from the TimeoutController:
> 
>     /**
>      * Executes <code>task</code> in a new deamon Thread and waits for the
> timeout.
>      * @param task The task to execute
>      * @param timeout The timeout in milliseconds. 0 means to wait forever.
>      * @throws TimeoutException if the timeout passes and the thread does
> not return.
>      */
>     public static void execute(Runnable task, long timeout) throws
> TimeoutException {
>         Thread t = new Thread(task, "Timeout guard");
> 
> 
> I did not see any switch regarding java 1.4. in the code.
> 
>  Michael
> 
> 
> 
> 
> 
> 2009/5/6 Oleg Kalnichevski <ol...@apache.org>
> 
>> On Wed, May 06, 2009 at 02:33:07PM +0200, Michael wrote:
>>> Hello,
>>>
>>> I am using version 3.1 and currently have some problems regarding thread
>>> management.
>>>
>>> $Header:
>>>
>> /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
>>> 1.47 2004/12/21 11:27:55 olegk Exp $
>>>
>>> From the code I would guess that I should not end up having more than
>>>
>>> HttpConnectionManagerParams params = new HttpConnectionManagerParams();
>>> params.setMaxTotalConnections(...)
>>>
>>> Threads called "Timeout Guard" flying around in my JVM. Unfortunately I
>>> limited it to 15 connections in total and find around 25 of those threads
>> at
>>> times. On my kind of limited virtual server that is currently  causing
>> some
>>> problems.
>>>
>>> I would appreciate some help. Thanks in advance...
>>>
>>>
>> What JRE are you using on that server? Timeout guard threads are used to
>> unblock socket connect operations on older (<1.4) JREs.
>>
>> Oleg
>>
>>
>>  Regards
>>>  Michael
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>> For additional commands, e-mail: dev-help@hc.apache.org
>>
>>
> 


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


Re: MultiThreadedHttpConnectionManager: How many threads?

Posted by Michael <mi...@gmail.com>.
Hi Oleg,

I am using

java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)

I think I am seeing the threads from the TimeoutController:

    /**
     * Executes <code>task</code> in a new deamon Thread and waits for the
timeout.
     * @param task The task to execute
     * @param timeout The timeout in milliseconds. 0 means to wait forever.
     * @throws TimeoutException if the timeout passes and the thread does
not return.
     */
    public static void execute(Runnable task, long timeout) throws
TimeoutException {
        Thread t = new Thread(task, "Timeout guard");


I did not see any switch regarding java 1.4. in the code.

 Michael





2009/5/6 Oleg Kalnichevski <ol...@apache.org>

> On Wed, May 06, 2009 at 02:33:07PM +0200, Michael wrote:
> > Hello,
> >
> > I am using version 3.1 and currently have some problems regarding thread
> > management.
> >
> > $Header:
> >
> /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
> > 1.47 2004/12/21 11:27:55 olegk Exp $
> >
> > From the code I would guess that I should not end up having more than
> >
> > HttpConnectionManagerParams params = new HttpConnectionManagerParams();
> > params.setMaxTotalConnections(...)
> >
> > Threads called "Timeout Guard" flying around in my JVM. Unfortunately I
> > limited it to 15 connections in total and find around 25 of those threads
> at
> > times. On my kind of limited virtual server that is currently  causing
> some
> > problems.
> >
> > I would appreciate some help. Thanks in advance...
> >
> >
>
> What JRE are you using on that server? Timeout guard threads are used to
> unblock socket connect operations on older (<1.4) JREs.
>
> Oleg
>
>
>  Regards
> >  Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: MultiThreadedHttpConnectionManager: How many threads?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, May 06, 2009 at 02:33:07PM +0200, Michael wrote:
> Hello,
> 
> I am using version 3.1 and currently have some problems regarding thread
> management.
> 
> $Header:
> /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v
> 1.47 2004/12/21 11:27:55 olegk Exp $
> 
> From the code I would guess that I should not end up having more than
> 
> HttpConnectionManagerParams params = new HttpConnectionManagerParams();
> params.setMaxTotalConnections(...)
> 
> Threads called "Timeout Guard" flying around in my JVM. Unfortunately I
> limited it to 15 connections in total and find around 25 of those threads at
> times. On my kind of limited virtual server that is currently  causing some
> problems.
> 
> I would appreciate some help. Thanks in advance...
> 
>

What JRE are you using on that server? Timeout guard threads are used to unblock socket connect operations on older (<1.4) JREs.

Oleg


 Regards
>  Michael

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