J2EE data caching mechanism

Discussions

EJB design: J2EE data caching mechanism

  1. J2EE data caching mechanism (2 messages)

    We are building a J2EE application.

    We have several sets of data which live in a database and are only modified once in a while, but are accessed often. We would like to build a caching mechanism so that the data is returned from the cache rather than calling the database everytime.

    The data in the database can be updated at any time. The data in the database will be updated via some external program (not through our application components). Therefore, we would need to have the database notify the cache when it has been updated, or build an interface to the cache to tell it that it is invalid.

    Our application will run on iAS 6.0 in a clustered environment. A cache component would probably exist on every app server. (We would not want only one instance of the cache, for all app servers because then the network traffic and other overhead might defeat the purpose of a cache). So then, if we were to build a something to tell the cache to update itself, we would want to update all instances of the cache via one central mechanism.

    Other details: the data we want to cache lives in DB2 running on an IBM mainframe (OS/390).Thoughts or comments on how to build?

    Any previous experience here?

    Threaded Messages (2)

  2. J2EE data caching mechanism[ Go to top ]

    You can use read only entity bean with a long time out period for caching purpose. The data will be refreshed
    only at the end of the time out period.

    As far as I know, there is no way to notify Weblogic or other app servers that cache is dirty and should be refreshed when data is modified by some other external process.

    We have a similar issue with the nightly batch update of our database. We are planning to simply shutdown and restart Weblogic.

    Pranab Ghosh
    Independent Consultant
  3. J2EE data caching mechanism[ Go to top ]

    Hi there Guys,
    First of all i am happy to inform u that there is a soln to the aforementioned problem and that is what pranab explained that u can increase the timeout of the entity bean. Carson be informed that the entity bean concept is nothing but a data caching mechanism. So if at all we could have this data cached for a long period then our problem is solved. So what u can do is increase the timeout and set the isModified method so as to avoid Dirty reads and update the database only when data changes. Also u can control the calls to the ejbLoad and the ejbStore using db-is-shared and isModified respectively.
    HTH
    sahil gupta