• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Use OSCache for performance tunning

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a J2EE web application for reporting. When user logged in he/she can view a menu having different reports. Each report is associated with a filter page, where user can select some filter values and can view the report on the basis of selected filter values. The filter page is same for all reports. On the filter page there are select boxes into which values are populating from the database by running different queries for each select box (we says filter value). So, following steps are performing -
  • Connecting to Database
  • Running Query
  • Setting returned records to bean
  • Display filter page by fetching records from bean

  • If user request for any other report, above steps are repeating again to populate filter page, which is obviously not a good design as connecting to database again and again is very expensive. So, I have decided to change the design.

    I have decided to use OSCache to cache the filter values (Bean objects) at server (user�s session). So that, if user would go to see another report then a filter page with cached filter values will be presented to him/her. In this way we are not going to hit the database server again until user�s session expired.

    I have gone through the documentation but still fighting to implement as the documentation, examples etc. are limited. I haven�t found any good example or help from the web.

    I would appreciate if anybody helps me as it�s really urgent.

    Thanks a lot.
     
    Greenhorn
    Posts: 24
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,

    To do the Cache analysis ... Please chack how much memory U have allocated for your JVM. For glance please do the code profiling.

    Thanks,
    Jafar....
     
    Author and all-around good cowpoke
    Posts: 13078
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    I have decided to use OSCache to cache the filter values (Bean objects) at server (user’s session).



    Seems to me you should be caching "filter values" at an application level if there is any chance that more than one user needs the same values so using user's sessions is a bad idea. Duplicating objects in multiple sessions is wasteful of memory. Near as I can tell OSCache is designed to operate at the application level already.

    Bill
     
    SaurabhSri Sri
    Ranch Hand
    Posts: 43
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi William,

    I have already mentioned that the filter values are common for all reports (There are 10 reports for each user and each report is having same filter page and so same filter values). I would be thinking to cache filter values for a user so that, if he/she would select a report first time then, filter values would get populated from database and cache those value to the server, and for other requests user would see values from the cache.

    Also, I would like to mention that filter page is common for all reports but not for all users. It means, if a filter value (say customer no.) is having values cust_1 and cust_2 for user_1, then these values would be same for all reports for user_1 but not necessarily for user_2.

    I hope this would be more clear to you gays now.

    Thanks
     
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    If user request for any other report, above steps are repeating again to populate filter page, which is obviously not a good design as connecting to database again and again is very expensive. So, I have decided to change the design.

    I have decided to use OSCache to cache the filter values (Bean objects) at server (user�s session). So that, if user would go to see another report then a filter page with cached filter values will be presented to him/her. In this way we are not going to hit the database server again until user�s session expired.




    ______________________
    iqbal
     
    Space pants. Tiny ad:
    Smokeless wood heat with a rocket mass heater
    https://woodheat.net
    reply
      Bookmark Topic Watch Topic
    • New Topic