Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: Shared cache best practices?

Finn, Michael

2004-01-07

Replies:

Depending on your container, you may get automatic invalidation for free - by using the appropriate "commit option" (without needing JMS). This is all assuming that all modifications to the tables that have the cached data are being done through entity beans.
 
In any event, it seems entity beans would be a good fit. You will need to decide whether to keep your strategy of separate caches per web server (which will mean an app server local to each web server).
 
Mike
-----Original Message-----
From: sven van't veer [mailto:sven@CORP.BLAH.COM]
Sent: Wednesday, January 07, 2004 12:20 PM
To: J2EE-INTEREST@JAVA.SUN.COM
Subject: Re: Shared cache best practices?

The way I do this is by JMS messageing. The EJB (Session Facade) responsable for altering the underlying DB after sucessful calls to the entity will send a JMS message with the PK to be invalidated to a topic. The cache listens to the topic and invalidates the cache entry with that specific PK.
 
sven
-----Original Message-----
From: Erik Beijnoff [mailto:erik@BEIJNOFF.COM]
Sent: Wednesday, January 07, 2004 12:34 PM
To: J2EE-INTEREST@JAVA.SUN.COM
Subject: Shared cache best practices?

Im facing a situation where my web server holds a rather extensive cache that is retrieved from a database. I'm seeking a way to be able to connect as many web servers as I'd like to that database and let each server be notified of the updates to the database so that they can keep their caches up to date. I'm looking for best practices in this area.
 
I'm aware of that one of the possibilities would be to put the cache on a common machine that all web servers access. However, this is not quite the solution I am looking for. The cache does not need to be same for all servers. On the contrary actually. The system is structured in such a fashion that each web server only holds in it's cache the information that is requested on that particular server for the moment. This could mean that each web server has completely different things in their caches. What I'm looking for is a signaling system that tells all web servers that are using that particular database that the data has changed in the database so that they can invalidate that particular portion of their caches so that it can be reread at the next request.
 
I suppose that keeping a separate cache server going also would create a somewhat rather large amount of overhead, granted, it would though be easier to gurantee consistency.
 
One of the options that I'm pondering would be a registration and deregistration process in a table in the database whenever a new web server connects to the it, and then let the servers signal updates to all the others through http or RMI or some other suitable method.
 
Or is this one of those magic moments where EJB actually would make sense?
 
Regards Erik Beijnoff
 
=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

this message contains information that may be privileged and confidential. unauthorized use, disclosure, dissemination and/or copying are strictly prohibited. if you are not the intended recipient, please delete this message and any attachments and notify us immediately. please do not copy this message or disclose its contents to anyone. thank you.
=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

©2008 junlu.com - Jax Systems, LLC, U.S.A.