----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------


Hi Martin,

This turns out to be a very difficult problem. If there's no access to the
database other than your application (in other words, if only your N
load-balanced machines will be writing to the database), the best solution
is probably to share your cache (via RMI or some remote protocol) on one
machine.

If this isn't a possibility, or if there are other access routes to the
database, you end up with a very nasty situation ... you need to know when
someone has updated the database (which you have cached), and this means
you need to somehow implement a listener API on your cached objects. Urgh.

There are a couple ways to do something like this. You can implement a
rather disgusting row listener architecture by placing update triggers on
all your database tables that insert "tableChanged" event records into an
event table (which your cache polls to figure out what's dirty). Pretty
unpleasant.

JDBC 2.0 includes a RowSet API, which I believe includes functionality for
row listener events. I looked at this a while ago, but never spent much
time on. To my knowledge, no major DB vendors implement this API yet (which
is a shame, because I know Oracle, at least, should in theory be able to
support this functionality).

Moral: unpleasant situation. Hope that helps.

Regards,
Ben Flaumenhaft.

>I need to design a high-traffic site with load-balanced configuration
>and database caching. The problem is, that users will  communicate
>by writing and reading to/from  database tables. So in the load-balanced
>environment if one user writes to the database, database caches on other
>machines need to be updated.
> Is there any solution available ? I have tried one commercial
>implementation
>of mapping db tables onto Java objects, but it doesn't work on multiple
>machines. Then I was thinking about using entity EJB, but are there
>any really usable implementations of entity EJBs available ?


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to