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
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".