How do I make "simple" throughput servlet-filter?

Posted by Tommy on Stack Overflow See other posts from Stack Overflow or by Tommy
Published on 2010-05-25T22:59:52Z Indexed on 2010/05/26 7:31 UTC
Read the original article Hit count: 384

I'm looking to create a filter that can give me two things: number of request pr minute, and average responsetime pr minute. I already got the individual readings, I'm just not sure how to add them up.

My filter captures every request, and it records the time each request takes:

public void doFilter(ServletRequest request, ...()  
{       
    long start = System.currentTimeMillis(); 
    chain.doFilter(request, response);
    long stop = System.currentTimeMillis();

    String time = Util.getTimeDifferenceInSec(start, stop);
}

This information will be used to create some pretty Google Chart charts. I don't want to store the data in any database. Just a way to get current numbers out when requested

As this is a high volume application; low overhead is essential.

I'm assuming my applicationserver doesn't provide this information.

© Stack Overflow or respective owner

Related posts about java

Related posts about Performance