This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Performance and the fly likes it takes longer time to show the report for the first time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "it takes longer time to show the report for the first time" Watch "it takes longer time to show the report for the first time" New topic
Author

it takes longer time to show the report for the first time

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
Hi,

I have developed an application using RADS. When i searched for the particular report, it takes pretty much time to load the data from database.
Reviewed the query and found tht it is optimized. Also done jsp precompilation option in RADS.
But still it takes longer time to load the screen. Below is the output in milliseconds. Can anyone guide me on this.

For fist time:

time for Query :: 24391 ms
time for coming out of DAO:: 17968 ms
time for coming out of Servlet :: 23968 ms

For second time
time for Query :: 4391 ms
time for coming out of DAO:: 7968 ms
time for coming out of Servlet :: 7968 ms
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What does your query do? Does it create any temporary tables or similar stuff that won't happen the second time? Is there any caching involved? Any more details you can give us?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
using query to feteched the data from DB2. No temporary table is used. Fetcing data using simple joins and with some run time parameters.
Sergey Babkin
author
Ranch Hand

Joined: Apr 05, 2010
Posts: 50
Probably on the first run all the related data and code gets loaded from disk into the caches, and does any other set-up tasks like opening teh connection, compiling the query etc., and then it runs from memory over the already established connection. It happens everywhere, the first time something runs is always slower. You can try to optimize by keeping as much of existing infrastructure open between the calls and reusing it.
 
 
subject: it takes longer time to show the report for the first time