• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reduce loading time of JSP page

 
Kapil Mishra
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys.....I have a JSP page on which about 10 on concurrent database connections work in parallel. and so much of calculation on these data going on...


I have used database connectivity directly on JSP page,i know its not a good practice but for that time its was my requirement to do work ASAP.

But now page is taking so much time in loading approx 1 min...I have tried connection pooling but all in vain..........


please reply........what can i do for reducing that time ??
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kapil Mishra wrote:I have a JSP page on which about 10 on concurrent database connections work in parallel. and so much of calculation on these data going on...


Try to reduce the number of database queries, cache their results, if possible, but first of all, add some logging to your code to get an idea of which part is taking so long to process so you'll know what is worth optimizing...
 
Kapil Mishra
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Lorand for replying.....Any other suggestion ???
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first step is to find out what is causing the long load time; logging -as Lorand suggests- is a good way of going about that. Only once you know if it's the data processing in the JSP, or one or more of the DB queries, that is causing the delay can you start working on improving things.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With databases, there are always joins you can optimize. There are nearly always joins you can get rid of.

If all else fails, you can implement some sort of stored procedure that tells the DBMS what you want, and have it do it all.

You never want to have bunches of simultaneous connections, you want one and you only want to make one call over it.

(not always easy to do this, but its always the goal)
 
John Melton
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is basically a question of optimization. The cardinal rule of optimization is measure first, then fix. You'll want to do what's already been suggested and log the time between each database call, as well as at the very beginning of the page and end. This way you can determine which calls seem to take the longest. I would run it repeatedly to get a good idea. Then, you'll need to start fixing each of the queries. This could involve adding indexes to the database (if you have that much control) which would fall under schema design. It could also be just straight query optimization. Those are issues however, that can be resolved. As was also mentioned earlier, you could go the route of stored procedures, which sometimes give a decent performance boost, but my guess is you're either missing indexes, have a TON of data, or have slow queries. Those are the places I'd look to start.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!