I’m doing a performance study for a web application framework running on Apache Tomcat 6.
I’m trying to measure the time overhead of handling HTTP requests.
What I would like to do is:
/
// just before first request byte is read
long t1 = System.nanoTime();
// request is processed...
// just after final byte is written to response
long t2 = System.nanoTime();
/
Then I would compute the total time (t2 – t1).
Is there a way to do this? Thanks for your help!
The best way to track this is probably with a Valve.
But I would be surprised if this isn’t already tracked in the MBeans that Tomcat exports. In particular, the MBean
Catalina:name=http-<my port num>,type=GlobalRequestProcessorlists the following attributes:Take a look at the documentation on Monitoring and Managing Tomcat to figure out how to access these MBeans with JMX.