1

I am struck with a question and thus seeking your help.

The maxThread count value in tomcat controls the max number of concurrent request which a tomcat can serve(my understanding), which means max number of threads working.

Now suppose I set maxThread =2 and there are two threads working simultaneously currently. If one of the thread creates 2 child threads(calling some other api).

My Question: If maxThread=2 can 4 threads(two parent + 2 child) exists? If yes what maxThread controls? If not what will happen in such case?

Pardon if I am difficult to explain myself.

Ankit S
  • 75
  • 2
  • 11

1 Answers1

0

For each HTTP request made on one of your connector, Tomcat creates one thread (the one named http-8080-thread1 for instance).

The maxThreads value controls those threads. It is totally possible that several other threads exists or can be created in the JVM when maxThreads is reached.

Also, take into account there is an acceptCount which sets the number of requests queued when all requests threads are busy.

More details in tomcat documentation

Cédric Couralet
  • 4,913
  • 1
  • 21
  • 21
  • But we also should keep in mind differents between threads and connections. Count of connections not always equal to count of threads. Tomcat have two different modes - NIO and BIO. http://stackoverflow.com/questions/24678661/tomcat-maxthreads-vs-maxconnections – Batiaev Apr 27 '16 at 18:26
  • @Cédric- Thank for the quick response. I am a little aware of the acceptCount and maxConnection params. All I want to cross verify if 'maxThreads' property controls the count of only Parent threads. I feel you are agreeing on it. Could you pls share some document favouring this. I could not get this in the document. – Ankit S Apr 28 '16 at 06:30