You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Yom-Tov <jo...@sysaid.com> on 2021/12/06 15:28:00 UTC

thread pool count never goes down

hi,

I have a single instance of Tomcat (version 9.0.54) in which the thread
count on a connector thread pool doesn't reduce despite most of the threads
(198/200) being idle. If I understand correctly the default idle time
before a thread is reaped is 60 seconds, but this situation persists for
hours. Any ideas for why this could happen?

Re: thread pool count never goes down

Posted by Jonathan Yom-Tov <jo...@sysaid.com>.
Got it, thanks. Happy holidays !




On Thu, 23 Dec 2021, 17:02 Christopher Schultz, <
chris@christopherschultz.net> wrote:

> Jon,
>
> On 12/21/21 04:55, Jonathan Yom-Tov wrote:
> > When I look at the source (and docs) I can see that the
> > StandardThreadExecutor, which is the default, has a max idle time of 60
> > seconds, after which the threads should be reaped. I can see in our
> > monitoring that for most Tomcats the thread count for the TLS connector
> > pool does decrease sometimes. So I wonder what could be causing the
> > executor to decide not to decrease the count in this specific instance?
>
> Oh, perhaps that has changed over the years. I'm sorry if I was wrong.
>
> Using a manually-configured executor should, of course, give you better
> control over everything as the <Connector> attributes don't fully-cover
> what you can configure for an explicitly-configured executor.
>
> Thanks,
> -chris
>
> > On Mon, Dec 20, 2021 at 9:47 PM Christopher Schultz <
> > chris@christopherschultz.net> wrote:
> >
> >> Jon,
> >>
> >> On 12/19/21 12:19, Jonathan Yom-Tov wrote:
> >>> hi Chris,
> >>>
> >>> Sorry for the late reply, I didn't see your reply for some reason.
> Here's
> >>> the relevant connector configuration:
> >>>
> >>>    <Connector port="10430" URIEncoding="UTF-8" protocol="HTTP/1.1"
> >>> connectionTimeout="20000" redirectPort="8443" maxHttpHeaderSize="8192"
> >>> scheme="https" secure="true" proxyPort="443"  relaxedQueryChars=" { }
> >>> " />
> >>> <Connector port="1043"  URIEncoding="UTF-8" protocol="HTTP/1.1"
> >>> relaxedQueryChars=" { } "
> >>>                  connectionTimeout="20000"
> >>>
> >>> redirectPort="8443" maxHttpHeaderSize="8192" />
> >>
> >> You are allowing Tomcat to automatically-configure an "Executor" for
> >> you, and that executor will never shed threads.
> >>
> >> You need to change your configuration so that you have this:
> >>
> >> <Service ...>
> >>
> >>     <Executor name="name-of-executor"
> >>       ...
> >>       />
> >>
> >>     <Connector port="10430"
> >>       executor="name-of-executor"
> >>       ... />
> >>
> >>     <Connector port="1043"
> >>       executor="name-of-executor"
> >>       ... />
> >>
> >> You can read more about the configuration of executors here:
> >> https://tomcat.apache.org/tomcat-9.0-doc/config/executor.html
> >>
> >> Note that your current configuration has separate thread-pools, one for
> >> each <Connector>. If you specify the "executor" configuration attribute,
> >> you can choose to share a single <Executor> or have separate ones for
> >> each <Connector>. If you want them separate, just define two of them and
> >> reference them appropriately.
> >>
> >> Hope that helps,
> >> -chris
> >>
> >>> On Tue, Dec 7, 2021 at 10:28 PM Christopher Schultz <
> >>> chris@christopherschultz.net> wrote:
> >>>
> >>>> Jon,
> >>>>
> >>>> On 12/6/21 10:28, Jonathan Yom-Tov wrote:
> >>>>> I have a single instance of Tomcat (version 9.0.54) in which the
> thread
> >>>>> count on a connector thread pool doesn't reduce despite most of the
> >>>> threads
> >>>>> (198/200) being idle. If I understand correctly the default idle time
> >>>>> before a thread is reaped is 60 seconds, but this situation persists
> >> for
> >>>>> hours. Any ideas for why this could happen?
> >>>>
> >>>> Maybe. Can you post your configuration?
> >>>>
> >>>> -chris
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>
> >>>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: thread pool count never goes down

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jon,

On 12/21/21 04:55, Jonathan Yom-Tov wrote:
> When I look at the source (and docs) I can see that the
> StandardThreadExecutor, which is the default, has a max idle time of 60
> seconds, after which the threads should be reaped. I can see in our
> monitoring that for most Tomcats the thread count for the TLS connector
> pool does decrease sometimes. So I wonder what could be causing the
> executor to decide not to decrease the count in this specific instance?

Oh, perhaps that has changed over the years. I'm sorry if I was wrong.

Using a manually-configured executor should, of course, give you better 
control over everything as the <Connector> attributes don't fully-cover 
what you can configure for an explicitly-configured executor.

Thanks,
-chris

> On Mon, Dec 20, 2021 at 9:47 PM Christopher Schultz <
> chris@christopherschultz.net> wrote:
> 
>> Jon,
>>
>> On 12/19/21 12:19, Jonathan Yom-Tov wrote:
>>> hi Chris,
>>>
>>> Sorry for the late reply, I didn't see your reply for some reason. Here's
>>> the relevant connector configuration:
>>>
>>>    <Connector port="10430" URIEncoding="UTF-8" protocol="HTTP/1.1"
>>> connectionTimeout="20000" redirectPort="8443" maxHttpHeaderSize="8192"
>>> scheme="https" secure="true" proxyPort="443"  relaxedQueryChars=" { }
>>> " />
>>> <Connector port="1043"  URIEncoding="UTF-8" protocol="HTTP/1.1"
>>> relaxedQueryChars=" { } "
>>>                  connectionTimeout="20000"
>>>
>>> redirectPort="8443" maxHttpHeaderSize="8192" />
>>
>> You are allowing Tomcat to automatically-configure an "Executor" for
>> you, and that executor will never shed threads.
>>
>> You need to change your configuration so that you have this:
>>
>> <Service ...>
>>
>>     <Executor name="name-of-executor"
>>       ...
>>       />
>>
>>     <Connector port="10430"
>>       executor="name-of-executor"
>>       ... />
>>
>>     <Connector port="1043"
>>       executor="name-of-executor"
>>       ... />
>>
>> You can read more about the configuration of executors here:
>> https://tomcat.apache.org/tomcat-9.0-doc/config/executor.html
>>
>> Note that your current configuration has separate thread-pools, one for
>> each <Connector>. If you specify the "executor" configuration attribute,
>> you can choose to share a single <Executor> or have separate ones for
>> each <Connector>. If you want them separate, just define two of them and
>> reference them appropriately.
>>
>> Hope that helps,
>> -chris
>>
>>> On Tue, Dec 7, 2021 at 10:28 PM Christopher Schultz <
>>> chris@christopherschultz.net> wrote:
>>>
>>>> Jon,
>>>>
>>>> On 12/6/21 10:28, Jonathan Yom-Tov wrote:
>>>>> I have a single instance of Tomcat (version 9.0.54) in which the thread
>>>>> count on a connector thread pool doesn't reduce despite most of the
>>>> threads
>>>>> (198/200) being idle. If I understand correctly the default idle time
>>>>> before a thread is reaped is 60 seconds, but this situation persists
>> for
>>>>> hours. Any ideas for why this could happen?
>>>>
>>>> Maybe. Can you post your configuration?
>>>>
>>>> -chris
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: thread pool count never goes down

Posted by Jonathan Yom-Tov <jo...@sysaid.com>.
hi Chris,

Thanks for your reply.

When I look at the source (and docs) I can see that the
StandardThreadExecutor, which is the default, has a max idle time of 60
seconds, after which the threads should be reaped. I can see in our
monitoring that for most Tomcats the thread count for the TLS connector
pool does decrease sometimes. So I wonder what could be causing the
executor to decide not to decrease the count in this specific instance?




On Mon, Dec 20, 2021 at 9:47 PM Christopher Schultz <
chris@christopherschultz.net> wrote:

> Jon,
>
> On 12/19/21 12:19, Jonathan Yom-Tov wrote:
> > hi Chris,
> >
> > Sorry for the late reply, I didn't see your reply for some reason. Here's
> > the relevant connector configuration:
> >
> >   <Connector port="10430" URIEncoding="UTF-8" protocol="HTTP/1.1"
> > connectionTimeout="20000" redirectPort="8443" maxHttpHeaderSize="8192"
> > scheme="https" secure="true" proxyPort="443"  relaxedQueryChars=" { }
> > " />
> > <Connector port="1043"  URIEncoding="UTF-8" protocol="HTTP/1.1"
> > relaxedQueryChars=" { } "
> >                 connectionTimeout="20000"
> >
> > redirectPort="8443" maxHttpHeaderSize="8192" />
>
> You are allowing Tomcat to automatically-configure an "Executor" for
> you, and that executor will never shed threads.
>
> You need to change your configuration so that you have this:
>
> <Service ...>
>
>    <Executor name="name-of-executor"
>      ...
>      />
>
>    <Connector port="10430"
>      executor="name-of-executor"
>      ... />
>
>    <Connector port="1043"
>      executor="name-of-executor"
>      ... />
>
> You can read more about the configuration of executors here:
> https://tomcat.apache.org/tomcat-9.0-doc/config/executor.html
>
> Note that your current configuration has separate thread-pools, one for
> each <Connector>. If you specify the "executor" configuration attribute,
> you can choose to share a single <Executor> or have separate ones for
> each <Connector>. If you want them separate, just define two of them and
> reference them appropriately.
>
> Hope that helps,
> -chris
>
> > On Tue, Dec 7, 2021 at 10:28 PM Christopher Schultz <
> > chris@christopherschultz.net> wrote:
> >
> >> Jon,
> >>
> >> On 12/6/21 10:28, Jonathan Yom-Tov wrote:
> >>> I have a single instance of Tomcat (version 9.0.54) in which the thread
> >>> count on a connector thread pool doesn't reduce despite most of the
> >> threads
> >>> (198/200) being idle. If I understand correctly the default idle time
> >>> before a thread is reaped is 60 seconds, but this situation persists
> for
> >>> hours. Any ideas for why this could happen?
> >>
> >> Maybe. Can you post your configuration?
> >>
> >> -chris
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

-- 
[image: -]
<http://www.sysaid.com/?utm_source=signature&utm_medium=email&utm_campaign=sysaid-logo>
[image:
-]
Jonathan Yom-Tov
Senior Architect
jonathan.yomtov@sysaid.com
Phone (IL): +972 (3) 533-3675 Ext. 932
Mobile (IL):  +972549174862
[image: -] <https://www.facebook.com/SysAidIT>   [image: -]
<https://twitter.com/sysaid>   [image: -]
<https://www.linkedin.com/company/sysaid-technologies-ltd>   [image: -]
<https://www.youtube.com/user/SysAidIT>   [image: -]
<https://www.instagram.com/sysaid_technologies/>
[image: Banner] <https://www.sysaid.com/sig-link>

Re: thread pool count never goes down

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jon,

On 12/19/21 12:19, Jonathan Yom-Tov wrote:
> hi Chris,
> 
> Sorry for the late reply, I didn't see your reply for some reason. Here's
> the relevant connector configuration:
> 
>   <Connector port="10430" URIEncoding="UTF-8" protocol="HTTP/1.1"
> connectionTimeout="20000" redirectPort="8443" maxHttpHeaderSize="8192"
> scheme="https" secure="true" proxyPort="443"  relaxedQueryChars=" { }
> " />
> <Connector port="1043"  URIEncoding="UTF-8" protocol="HTTP/1.1"
> relaxedQueryChars=" { } "
>                 connectionTimeout="20000"
> 
> redirectPort="8443" maxHttpHeaderSize="8192" />

You are allowing Tomcat to automatically-configure an "Executor" for 
you, and that executor will never shed threads.

You need to change your configuration so that you have this:

<Service ...>

   <Executor name="name-of-executor"
     ...
     />

   <Connector port="10430"
     executor="name-of-executor"
     ... />

   <Connector port="1043"
     executor="name-of-executor"
     ... />

You can read more about the configuration of executors here:
https://tomcat.apache.org/tomcat-9.0-doc/config/executor.html

Note that your current configuration has separate thread-pools, one for 
each <Connector>. If you specify the "executor" configuration attribute, 
you can choose to share a single <Executor> or have separate ones for 
each <Connector>. If you want them separate, just define two of them and 
reference them appropriately.

Hope that helps,
-chris

> On Tue, Dec 7, 2021 at 10:28 PM Christopher Schultz <
> chris@christopherschultz.net> wrote:
> 
>> Jon,
>>
>> On 12/6/21 10:28, Jonathan Yom-Tov wrote:
>>> I have a single instance of Tomcat (version 9.0.54) in which the thread
>>> count on a connector thread pool doesn't reduce despite most of the
>> threads
>>> (198/200) being idle. If I understand correctly the default idle time
>>> before a thread is reaped is 60 seconds, but this situation persists for
>>> hours. Any ideas for why this could happen?
>>
>> Maybe. Can you post your configuration?
>>
>> -chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: thread pool count never goes down

Posted by Jonathan Yom-Tov <jo...@sysaid.com>.
hi Chris,

Sorry for the late reply, I didn't see your reply for some reason. Here's
the relevant connector configuration:

 <Connector port="10430" URIEncoding="UTF-8" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" maxHttpHeaderSize="8192"
scheme="https" secure="true" proxyPort="443"  relaxedQueryChars=" { }
" />
<Connector port="1043"  URIEncoding="UTF-8" protocol="HTTP/1.1"
relaxedQueryChars=" { } "
               connectionTimeout="20000"

redirectPort="8443" maxHttpHeaderSize="8192" />



On Tue, Dec 7, 2021 at 10:28 PM Christopher Schultz <
chris@christopherschultz.net> wrote:

> Jon,
>
> On 12/6/21 10:28, Jonathan Yom-Tov wrote:
> > I have a single instance of Tomcat (version 9.0.54) in which the thread
> > count on a connector thread pool doesn't reduce despite most of the
> threads
> > (198/200) being idle. If I understand correctly the default idle time
> > before a thread is reaped is 60 seconds, but this situation persists for
> > hours. Any ideas for why this could happen?
>
> Maybe. Can you post your configuration?
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

-- 
[image: -]
<http://www.sysaid.com/?utm_source=signature&utm_medium=email&utm_campaign=sysaid-logo>
[image:
-]
Jonathan Yom-Tov
Senior Architect
jonathan.yomtov@sysaid.com
Phone (IL): +972 (3) 533-3675 Ext. 932
Mobile (IL):  +972549174862
[image: -] <https://www.facebook.com/SysAidIT>   [image: -]
<https://twitter.com/sysaid>   [image: -]
<https://www.linkedin.com/company/sysaid-technologies-ltd>   [image: -]
<https://www.youtube.com/user/SysAidIT>   [image: -]
<https://www.instagram.com/sysaid_technologies/>
[image: Banner] <https://www.sysaid.com/sig-link>

Re: thread pool count never goes down

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jon,

On 12/6/21 10:28, Jonathan Yom-Tov wrote:
> I have a single instance of Tomcat (version 9.0.54) in which the thread
> count on a connector thread pool doesn't reduce despite most of the threads
> (198/200) being idle. If I understand correctly the default idle time
> before a thread is reaped is 60 seconds, but this situation persists for
> hours. Any ideas for why this could happen?

Maybe. Can you post your configuration?

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org