0

The maximum number of threads set in tomcat server.xml is 200, but when I count the number of threads belonging to the process using ps huH <pid> | wc -l , I get 566. What am I missing?

Update
There is only a single connector and a single executor, and the maxThreads is set on the executor as 200.

avmohan
  • 1,820
  • 3
  • 20
  • 39

1 Answers1

2

Tomcat has a default thread pool size of 200 per Connector so in your installation there might be several active connectors.

Besides the threads in the connector thread pools Tomcat may create other threads, and of course the JVM itself has own threads e.g. for the garbage collector.

wero
  • 32,544
  • 3
  • 59
  • 84
  • So how do I get the actual number of threads in the Connector's thread pool , and how many of them are active? – avmohan Apr 09 '16 at 15:19
  • @v3ga I guess Tomcat puts connector threads into a ThreadGroup. You could use http://stackoverflow.com/a/1323480/3215527 to examine the thread groups and based on that answer your questions – wero Apr 09 '16 at 15:26
  • Apparently, tomcat executor has a namePrefix option and the threads are named as $namePrefix+$thread_number. Thanks for the help. Now I am trying to get the list of threads not through code as in the linked question, but through some external command - maybe jstack – avmohan Apr 09 '16 at 15:42