You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aquib Khan <aq...@ukg.com.INVALID> on 2020/10/28 12:31:14 UTC

Enable Logging to Print Max Threads

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

Re: Enable Logging to Print Max Threads

Posted by Christopher Schultz <ch...@christopherschultz.net>.
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org