Enable Logging to Print Max Threads

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Enable Logging to Print Max Threads

Aquib Khan

Hi,

 

We are using Tomcat Version : 8.5.53.

OS Name:        Linux

OS Version:     3.10.0-1127.18.2.el7.x86_64

 

We have a requirement where we wanted a logger to get printed in Catalina.out when Tomcat reaches it’s max thread limit.

 

We reduced values of properties : minSpareThreads, maxThreads and acceptCount in server.xml. Also changed logging level to ALL/DEBUG in logging.properties.

 

When we made higher number of requests to tomcat we face java.net.SocketTimeoutException: Read timed out Exception on client side but no Log or Exception on Tomcat side.

 

What change we have to perform, so that tomcat indicates it’s thread limit has reached or it is about to reach that limit.

 

Attaching screenshot of server.xml and Logging.properties.

 

Any help would be appreciable

 

Regards,

Aquib



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Enable Logging to Print Max Threads

Christopher Schultz-2
Aquib,

On 10/28/20 08:31, Aquib Khan wrote:

> Hi,
>
> We are using Tomcat Version : 8.5.53.
>
> OS Name:        Linux
>
> OS Version:     3.10.0-1127.18.2.el7.x86_64
>
> We have a requirement where we wanted a logger to get printed in
> Catalina.out when Tomcat reaches it’s max thread limit.
>
> We reduced values of properties : /minSpareThreads, maxThreads and
> acceptCount/ in server.xml. Also changed logging level to ALL/DEBUG in
> logging.properties.
>
> When we made higher number of requests to tomcat we face
> */java.net.SocketTimeoutException: Read timed out/ *Exception on client
> side but no Log or Exception on Tomcat side.
>
> What change we have to perform, so that tomcat indicates it’s thread
> limit has reached or it is about to reach that limit.

Tomcat doesn't bother to log when it hits its maximum thread limit
because it's an unremarkable event. Who cares that you've hit your max?

Well, obviously YOU care.

The MXBeans for thread pools, etc. don't have any subscribable events.
Theoretically, you could listen for attribute change notifications from
an MXBean but none have been programmed into Tomcat.

> Attaching screenshot of server.xml and Logging.properties.

Screenshots don't make it to this list. You gotta use text to communicate.

If it's not important to know the exact moment you hit your high-water
mark, you could poll Tomcat via JMX to find out what the current
max-threads is and the current active-threads. If you have
active-threads=max-threads=max-max-threads then you know that your
server is saturated.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]