• Post Reply Bookmark Topic Watch Topic
  • New Topic

Slow Loading JSP

 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page that returns results from a query. When the number of results is large, the page loads slowly. I tried stripping out all of the iteration logic and only displaying summary data (data that is displayed once per page), but it still loads slow. Here is a snippet of the summary data:



The properties shown above on reportBean are Strings. ReportBean is in request scope. A TreeMap property that is not being outputted on the page contains most of the results of the large query. Any ideas?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How large is large? 100? 1000? 10000?

What exactly consumes the most time? Run a profiler. How long does the request-response cycle at the server side take? (this to exclude the render time of the webbrowser at the client side)
 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The test data I am using has over just over 10,000 items. It is possible to have many more results (on the order of 100,000). When the TreeMap containing the majority of the results isn't populated, everything runs quickly. It is only when the TreeMap is populated that everything slows down (even when the TreeMap isn't output to the screen). I will see if I can't setup a profiler to get more specifics.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using JSF please post any questions in the JSF forum. I've moved this one there.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy Holm wrote:The test data I am using has over just over 10,000 items. It is possible to have many more results (on the order of 100,000). When the TreeMap containing the majority of the results isn't populated, everything runs quickly. It is only when the TreeMap is populated that everything slows down (even when the TreeMap isn't output to the screen). I will see if I can't setup a profiler to get more specifics.
Why that lot at once? Where does that information come from? What do you need it for? I can't imagine that one would like to see all the 10,000 or more at once. At highest 100 is a respectable limit when viewing data at once. The remaining data could just be accessed by paging techinques.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is definitely a lot of data. however, as you mentioned, it seems like the slowdown actually occurs in the process that populates the treemap.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, to my experience, in case of those amounts of data, the biggest bottleneck is the webbrowser used at the client side.

Let's give a rough example: when using decent hardware and network, transferring 10,000 records from a well-indexed SQL database into Java's memory using well-written Java code shouldn't last more than one second. Letting JSF to render a table with that amount of rows shouldn't last more than two times of the time the DB needed to return the records, so it's at highest 2 seconds. The total time of request-response cycle should be not more than 3 seconds. You can easily test it using a Filter:

Once the response is completed, left behind the render time of the webbrowser used at the client side. To experience, MSIE is the slowest in this and Opera is the quickiest in this. Depending on the webbrowser and the hardware of the client machine used, the render time could roughy range from 3 seconds up to 10 seconds or even (much) more.

With regard to effective pagination, you may find this article useful: http://balusc.blogspot.com/2008/10/effective-datatable-paging-and-sorting.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!