• 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

how to make my application run faster

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello buddies,
i am using JSP and Oracle 9i to develop my application. i want to design a JSP page where it shouls get the data from oracle and print in the browser in a table(used <table>...</table> tags).in oracle table there are around 1000 records and i want to print all of them in the browser. i have created the jsp which has db connections and display the data, but it takes some 15 min to generate the page.what and which technology i need to do inorder to load my page faster.i have used tomcat 5.0 as webserver.
plz tell which are the best practices to generate pages like from DB.
plz guide me..
thanks and regards,
Mahesh
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

First of all - you should understand how that time breaks down to different tasks. You have

1)getting the data from the database
2)compiling the data onto a jsp page
3)sending the data from the server to the client
4)rendering the html in the browser

As a former interface developer, I will comment on 3 and 4, and let others comment on the first two.

I hope this is for yourself and not for your users, because you may end up crashing some machines with that much data - and users do not like that. It is always a best practice to break information into digestable bits.

But assuming it must be this way we have to keep code at a minimum, and keep html structures simple.

NO TABLES! They are deprecated anyway, and it takes a browser extra time to output tables.

If you can just go with this...

ITEM - DATA,DATA,DATA<br>
ITEM - DATA,DATA,DATA<br>
ITEM - DATA,DATA,DATA<br>
ITEM - DATA,DATA,DATA<br>

Avoid images and anything nested (span within divs, or whatever. If you want to make it looks nice you will have to break it up into bits.

That's it really. I could comment on the jsp bit, but there are probably others more qualified.

Jon
----------------
Get Jobs on GoodNoodles
http://www.goodnoodles.com
[ October 04, 2004: Message edited by: Ezra Simon ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, shoving hundreds or thousands of records at your users generally isn't a very useful thing to do. Investigate paging the records.



Ummm, no. They are not. Where do you hear that from?

Tables are still the best way to display tabular data. (They are however, oveused for layout where CSS would be more appropriate). Modern browsers have no problems renderring even complex tables as long as you do not nest too deeply (which usually is a sign that you are using tables incorrectly).

The 15 minute lag is most probably a network or database issue. The use of tables or nesting spans in the HTML is not going to add any appreciable time to that kind of lag.
[ October 04, 2004: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are making DB connection every time JSP is requested, that operation might eat some time. Try using connection pooling, in which DB connections are already made and are used as requested.
[ October 04, 2004: Message edited by: Jmannu gundawar ]
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for ur suggestions. but i am having one more doubt here. Ok now i am havig some 500 records in the resultset and i need not display all the 500 records in a single page , infact in multiple pages like first 100 in a page and next 100 in 2nd page like this.how can actually solve this.
thanks & regards,
Mahesh
 
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mahesh
you have to use paging for that....
you can search this forum there are number of discussions on this topic.
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use seperate class for connection
 
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

For paging, you can do a search on this or you can use the Pager Taglib.

HTH
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, you have done the paging but you are still doing full table scan. isn't it??

actually, it is very unlikely to do full table scan when the table has thousands of record. please make sure your database is tunned perfactly, specifically indexing could be the issue. but again avoid full table scans because indexes don't help in full table scans and it results in performance lack.

and as aforementioned, use connection pooling instead of getting connection while having request.
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For paging use the Iterator pattern.
I have used this & also got succeeded in this ..
Refer to
http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html
this is best as far as i know.

Any way this approach first collects all the data from the DB initially.
Else try creating indexes in the DB for faster data retrival.

Srini
[ October 05, 2004: Message edited by: srini vasan ]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Malhar Barai:
Hi,

For paging, you can do a search on this or you can use the Pager Taglib.

HTH



better yet, use JSTL which is standardised.

But best of all, tune that SQL to allow for retrieving only a subset of the data and not get all thousand records for each page of 100.

A 15 minute delay on requesting a JSP like yours is a database issue.
Most likely there's a major problem with bad indices, possibly combined with connections not being closed (causing you to have to wait until they time out).
Combine that with a long time needed to collect and transmit to your application server the massive amount of data you request with each query and you're bound for disaster.
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are going to have to do some measuring to see where things are slow.

I'll make a guess though. A 1000 row table shouldn't take 15 minutes to render so I would guess the query is slow (you can test this by running the query outside of your program in some sql tool), or you are concatenating strings and causing object allocation and garbage collection to be time consuming.

For example if you have a 200,000 character string and concatenate a "<td>" to it then a new string would have to be allocated to include the 200,004 characters and all data would have to be copied into here and then the old string would have to be garbage collected. If this is done a lot it is obvious how slow this could be. If you used a StringBuffer and the append method you wouldn't have this problem. Of course all this is a guess on my part and you should monitor your code to see what is consuming all the time.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use value list handler pattern for displaying records
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

i suggest you to tune the application in all the layers

1) SQL :

make sure you are using right Optimized scan
(index based or full scan that suits your need)

consider to use First N Row Optimization

2)
Model :
If it is possible implement dynamic caching


3)

Presentation:

Use compression before sending response to the client
(employ filter to that job)

If you have time explore each topic further
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


i suggest you to tune the application in all the layers



Without performance measurements, developers will spend their time guessing where performance bottlenecks occur. Performance problems typically occur in a small percentage of overall code. Algorithm guru Donald Knuth estimated that 4% of application code accounts for 50% of the performance. With measurements, developers can quickly locate that 4% of the code and get the biggest bang for their tuning buck. Without measurements developers waste effort tuning code that may have no significant impact on performance.
 
ravuthakumar gopalakrishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i agree with steve souza
Always eye on ROI.


-----
Sun Certified Programmer
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks alot guys for ur valuable suggestions. it really improved that damn performance.now i can generate the jsp within seconds.i have to thankful to one and all who have contributed their info to this article.
regards,
Mahesh
 
Manoj Gundawar
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mahesh,
What was causing performance bottleneck in your appliaction? What did you fianlly do to improve it? Could you please give some details?
[ October 07, 2004: Message edited by: Jmannu gundawar ]
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic