• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reduce loading time of JSP page

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ??
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lorand for replying.....Any other suggestion ???
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic