views:

519

answers:

3

Hi All,

I have 15000 records in an arraylist each record size is around 2MB. I have display this list on a jsp page in the most efficient manner.

Please suggest the best method to do it.

I can not filter data on server side. User needs all records on jsp page at once.

Thanks in advance.

A: 

I don't know if there is a really performant way for displaying that many records but you may have a list at the jQuery Grid (the Demo page has an example under Advance/Search big sets for displaying and searchign 12000 records). Alternatively any other JavaScript Grid like the one from ExtJS may be helpful.

Daff
Thanks for the solution. I am actually looking for some solution which will take into consideration no of database trips for fetching 12000 records + no of concurrent users.
rajesh
Hm if your database can't fetch 12000 records and add some paging in a more timely manner than it would take the client to render that amount of date you may want to rethink your db design. As Stephen already said, displaying that many data at once will probably kill the client (it is not only the 2 MB of data to be rendered).
Daff
can we have some kind of serialization to avoid long timed database connection? In that case load on database side will be low and recursive fetch can be done from file system.
rajesh
If the records don't change that often you could use Memcached to store them and do the Paging in Java. The question is, if one time retrieval of 12000 records is really necessary (I would never view all of them). There even is the probability that the load would probably be lower if you do database paging because you only have to retrieve a small amount of items.
Daff
What is Memcached ?
rajesh
Memcached is a distributed memory caching system (though you would need kind of 30 Gigs of ram for your records) see http://en.wikipedia.org/wiki/Memcached
Daff
+5  A: 

The straightforward answer is that you cannot render 15,000 * 2Mb records in a simple JSP. That amounts to a 30Gb web page (+ formatting) which would have to be rendered by the server transmitted to the browser, and then buffered and displayed by the browser. That simply will not work. For a start, your users' machines won't have 30Gb of RAM.

So that means that you are going to have to implement a more complicated solution in which you provide the user with some kind of table or list viewer that allows the user to page or scroll through the 15,000 records without sending the whole lot to the user's browser. The old-school approach is to implement the list view / scrolling logic and rendering on the server side. The Web 2.0 way is to use some Javascript toolkit to implement the display and scrolling on the client side, using AJAX calls to fetch records from the server as the user looks at them.

Stephen C
I believe the poster did not say that the rendered record would be 2 Mb.
Thorbjørn Ravn Andersen
The question is not clear, but (IMO) this is a plausible extrapolation of what he meant.
Stephen C
A: 

flush() your response writer regularily to send data to the client.

Ensure that you do not use mile-high tables or similar which requires the browser to deal with many objects in order to be able to do layout.

Tell user to use a modern browser. I belive Opera does well with these kind of pages.

Thorbjørn Ravn Andersen
I don't think we can flush record by record to jsp. In that case it will throw response already committed error.
rajesh