EJB design: paging

  1. paging (2 messages)

    i need to handle a search that can return a very large resultset. I considered the following options -
    a) Get the results from the DB and store about 10 pages at a time in a stateful session bean, which is the cache. If a page cant be found in the cache, query the DB and get the results. I will have a max number of pages say 20 which the cache can build to. If 30 pages are reached,and a page is requested remove the first 10.

    b) The cache is stored in the web server session object. A stateless session bean is used to access the DB and create/update the cache if required. This saves me a network call if the user navigates to pages that are in the cache but makes the session heavy and does not allow the traditional container benefits like instance pooling.

    c) Get all the results and store as an XML file in the web layer. If the same query is sent by multiple users,then the XML file is used to access the info and return results.
    Here the session is light, there is a one time overhead of creating the XML file, but it is shareable and subsequent accesses can be fast.

    Can anybody tell me what are the other issues that could affect performance and other factors on which these strategiees can be compared

    Threaded Messages (2)

  2. paging[ Go to top ]

    Take a look at the Value List Handler pattern. It might be of help.
  3. paging[ Go to top ]


    there are many issues to think on..
    Among the first and the most imp, are the
    I/O and the database operations..

    So try to read more records from the database
    depending on the nature of the application.

    Then you, can use a cached rowset to store in the
    session as an alternate to storing the XML file.
    Also, create an XSL file for a specific type of display.
    Store thses XSL files in the session too.

    Anyone, needing to display the page, gets the cached row,
    converts it int o the XML file and apply the XSL to it,
    to transform the XML in to the HTML.

    Dimple Rana