Michael Neale Michael Neale - 1 month ago 10
Java Question

Measuring the number of queued requests for tomcat

So with tomcat you can set the acceptCount value (default is 100) which means when all the worker threads are busy - new connections are placed in a queue (until it is full, after which they are rejected).

What I would like is to monitor the size of items in this queue - but can't work out if there is a way to get at this via JMX (ie not what the queue max size is - that is just config, but what the current number of items are in the queue).

Any ideas appreciated.

Config for tomcat: http://tomcat.apache.org/tomcat-6.0-doc/config/http.html (search for "acceptCount")

Answer

This thread on the mailing list and the reply from Charles suggests that no such JMX exists.

Quote from Chuck: "Note that the accept queue is not visible to Tomcat, since it's maintained by the comm stack of the OS."

Quote from David : "Unfortunately, since Tomcat knows nothing about the requests in the accept queue,...."

Is there no way to get this information (How much requests are in the accept queue?) out?

No, the accept queue is completely invisible. Only the comm stack knows anything about it, and there are no APIs I'm aware of to queue the contents - because the content hasn't been received yet, only the connection request.

Depending on what your real problem is (i.e. for measuring requests in the accept queue which Tomcat has not yet begun procesing) if you're looking at a "throttling solution" see this follow-up on the same thread.