This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JSP and the fly likes jsp response time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp response time" Watch "jsp response time" New topic

jsp response time

tony al

Joined: Jul 03, 2002
Posts: 8
I am interested in measuring the response time for a jsp i.e; the time between the instant the request is received by the JSP, to the instant the result in html in produced(on server side). Note that this does not include the network transmission time.
I tried using simple system.currenttimemillis() at the start and end of the jsp; but this does not given me the right values.
Any help in this in highly appreciated.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027
Thats the only call to get system time. Why do you think it is not working?
tony al

Joined: Jul 03, 2002
Posts: 8
I am actually interested in finding the variation in the jsp response time as the load on the jsp increases. But, I am not noticing any difference in jsp response time with increase in load, using my current method. I think this is because I am not taking into account the wait time between when the http request was recevied to when the actual processing of the jsp began. I do notice that the jsp output is much slower with increase in load, but the response time using my current method remains the same.
So if there was a way to find the time when the actual HTTP request was received, rather than just when the jsp processing started(as done by using the system.currenttimeinmillis at the beginning of the jsp), I think I would find a solution to this.
Thanks for your help
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
Which JSP container are you using? If you have the source code you could probably put time logging in the network protocol handling code.
In practice, though, the obvious way is to use one of the many tools which measure remotely and include the network latency in the total. That's what matters to users, after all.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Ashok Haluvarthi

Joined: Jul 04, 2002
Posts: 13
Hello Sir,
Take this
u place this at the start of ur jsp page
long stime = System.currentTimeMillis();
//statement or data..any thing...

long etime = System.currentTimeMillis();
double elapsed = (etime - stime)/1000.0;
try it out...
I agree. Here's the link:
subject: jsp response time
It's not a secret anymore!