On 18/10/2012 14:39, Shanti Suresh wrote: > Hi Pid, > > Thanks for your comments! > > I would like a representative metric of how many active threads are in > Tomcat at a given time. "currentBusyThreads" may or may not be a good > counter because at the time of poll, there is one current operation or none > - giving me a value or "1" or "0" consistently. And again, that may just > be the case. In the middle of the night, though, I sometimes get a > "currentBusyThreads=50" value, perhaps due to a spidering of the site or > another batch operation on the server. > > What is "DaemonThreadCount=85" please?
Which MBean are you reading that on? > Is that the current size of the ThreadPool? Tomcat has lots of MBeans and more than one way to create a thread pool. The JVM has threads and can contain multiple thread pools. > I looked at our server.xml, and an Executor ThreadPool is not > in use for the 8080 and 8443 HTTP connectors. Could that mean that idle > threads are not expired properly? So at one point, the thread pool size > could have gone up to 85. Yes, as of Tomcat 6.0.x, without an Executor the Connectors will have a pool each, and this will not decrease in size when idle. > --------------server.xml snippet:------- > <Connector port="8443" > clientAuth="false" > connectionTimeout="60000" > disableUploadTimeout="true" > emptySessionPath="true" > enableLookups="false" > maxHttpHeaderSize="8192" > maxSpareThreads="75" > maxThreads="256" > minSpareThreads="25" > protocol="HTTP/1.1" > scheme="https" > secure="true" > SSLEnabled="true" > sslProtocol="TLS" > URIEncoding="UTF-8" > acceptCount="100" > SSLCertificateFile="cert.cer" > SSLCertificateKeyFile="cert_key.key > " > /> > > ------end of snippet---------------------- > > A quick browse on Google showed up the following discussion: > http://tomcat.10.n6.nabble.com/Managing-Tomcat-6-threads-How-to-make-tomcat-destroy-threads-when-idle-td2114714.html > > I might need to change the server.xml to use the executor Thread Pool, I > think. Enable the Executor to manage the thread pool size when idle, yes. p > Thanks. > > -Shanti > > On Wed, Oct 17, 2012 at 9:07 AM, Pid <p...@pidster.com> wrote: > >> On 16/10/2012 17:52, Shanti Suresh wrote: >>> Greetings. >>> >>> I have some questions on finding the number of active threads in Tomcat. >>> (1) On our QA system, I notice that the currenthreadsBusy MBean is >>> either zero or one for the 8443 and 8080 connectors. >> >> ThreadCount != currentThreadsBusy >> >> One is the count of threads, one is the threads that are doing work. >> >> >>> Why then is ThreadCount = 93 when there is not much going on on QA? >> >> Because you've previously done enough work for Tomcat to maintain 93 >> threads. >> >> >>> (2) When I want to graph the thread activity in Tomcat (the thread >>> Pool usage), which is a better counter to look at - currentThreadsBusy >>> or "ThreadCount"? >> >> Depends what you want know. >> >> >>> It seems like "ThreadCount" is what JConsole displays as "Live Threads". >>> (3) Why is TotalStartedThreadCount: 264? Is that a cumulative total >>> since Tomcat was restarted? >> >> Yes. >> >> >> p >> >>> --------------Thread-related MBean snippet:--------- >>> >>> Name: Catalina:type=ThreadPool,name="http-apr-8443" >>> currentThreadsBusy: 1 >>> ... >>> >>> Name: Catalina:type=ThreadPool,name="http-apr-8080" >>> currentThreadsBusy: 0 >>> ... >>> >>> Name: java.lang:type=Threading >>> DaemonThreadCount: 85 >>> PeakThreadCount: 99 >>> AllThreadIds: Array[long] of length 93 >>> 135 >>> 119 >>> 118 >>> 117 >>> ... >>> >>> CurrentThreadCpuTime: 4600000000 >>> CurrentThreadUserTime: 4020000000 >>> ThreadCount: 93 >>> TotalStartedThreadCount: 264 >>> ThreadCpuTimeSupported: true >>> ... >>> ---------------end of snippet------------------------ >>> >>> Thanks! >>> >>> -Shanti >>> >> >> >> -- >> >> [key:62590808] >> >> > -- [key:62590808]
signature.asc
Description: OpenPGP digital signature