Question 1:
This questions describes what is the currentTheadBusy and the currentThreadCount mbeans, but there is the connectionCount mbean.
In this moment, the values of this 3 mbeans on my production Tomcat Application are:
currentTheadBusy: 1
currentThreadCount: 36
connectionCount: 249
Why are there so much more connections than threads? How I read this values?
Question 2:
How the connectionCount is related with the Manager/localhost/myapp/activeSessions mbean? The current value of this mbean is 1125. Are those values related or I am missing the concept?
Thanks.
The connectionCount
is the number of connections the connector has handled, and is largely irrelevant. Clients will typically make a connection, make several requests through that connection, and then close the connection. If you have a reverse-proxy like Apache httpd, nginx, etc., then there may be a single connection handling huge numbers of requests over time.
Why are there so much more connections than threads?
Because a thread pool with a small number of threads can handle a lot of work over time, especially if overall load it low. If you get 1 request per second all day long and no request takes longer than 1s to complete, then a single thread can handle 100% of your load. If each client makes a 1 connection for 1 request and then closes the connection, that will be 1 * 60 * 60 * 24
= 86400
connections handled by a single thread during a 24-hour period.
If your requests take just less than 1s to complete, then you can handle 86400 requests per day with a single thread. You can handle 2 * 86400
= 172800
connections/requests per day with only one additional thread in your thread pool (from 1 to 2 threads).
How the connectionCount is related with the Manager/localhost/myapp/activeSessions?
It is not related.
[Am I] missing the concept?
The manager
MXBean tracks HTTP session management. You currently have 1125 active sessions in your application.
Have a look at the fine presentations on Tomcat's presentations page. Specifically, search for "monitoring".