[jboss-user] [JBoss Cache] New message: "Re: Preload second level cache"

Brian Stansberry do-not-reply at jboss.com
Fri Jan 8 08:48:48 EST 2010


User development,

A new message was posted in the thread "Preload second level cache":

http://community.jboss.org/message/518961#518961

Author  : Brian Stansberry
Profile : http://community.jboss.org/people/bstansberry@jboss.com

Message:
--------------------------------------------------------------
I take it populating the cache by reading the data from the db is not an option? Coordinating this across the cluster using something like the JBoss AS HASingleton or a clustered Quartz job?
 
The reasons use of a CacheLoader is considered incorrect in the JPA/Hibernate use case are:
 
1) What's the point of adding another moving part when there's already another persistent store of the data? Well, if you've got a use case you really can't solve a better way, this reason is somewhat negated.
 
2) Writing to the CacheLoader every time the data changes is expensive. But if it never changes, you only bear this cost the first time you populate the cache.
 
3) You've now got two copies of the data that can fall out of sync, e.g. you shut the cluster down and while it's down someone changes the database. Restart the cluster and you won't see those changes in your app. If you don't use a shared cache loader, this problem is much worse; you've got n + 1 copies of the data, where n is cluster size.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/518961#518961




More information about the jboss-user mailing list