On 30/04/2024 21:24, Jerry Malcolm wrote:
I'm trying to optimize my instance, CPU, tuning, and size requirements for Tomcat.  It's easy to see CPU usage.  But this TC instance is running a lot of microservices that are often in and out fairly quickly.  So there can be a huge number of requests coming in.  I'm not sure that CPU starving is my biggest concern. I'm more interested is getting an understanding of TC front end bottlenecks and also JDBC data connection bottlenecks.   So I need a bit of education.   Am I correct that maxThreads on the connector throttles the number of requests that can come in at one time?

Not quite.

maxThreads is the maximum number of concurrent requests that Tomcat can process. This excludes:
- connections in keep-alive
- requests that have entered async mode and have exited the original
  container thread
This includes:
- multiple requests received on a single HTTP/2 connection

The maximum number of connections is controlled by maxConnections.

And connectionTimeout is the time to wait to get in the door if threads are maxed out before giving up and failing, correct?

No. It is the maximum time Tomcat will wait from the point the connection is accepted to reading the first byte of data.

I'd really like to track total threads in use and then track wait time if total threads are maxed out.  Likewise, with database connections.

You can track the status of the thread pool but wait time isn't available as Tomcat has no visibility into the accept queue (see acceptCount). Your OS might provide some stats here.

  I'd like to monitor the jdbc connection pool as well and see when and where the code is having to wait for a db connection and how long the average wait is.  I assume there are jms hooks to monitor this?

Correct. You probably want the stats from the o.a.t.u.dbcp.pool2.impl package.

But I don't want to reinvent the wheel.  Are there tools out there to assist with this already? Thx

Generally, I start with a profiler when looking at questions like this. I use YourKit because they given me a free copy to use for Tomcat development but there are lots of different profilers available.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to