Hi, I previously had a lot of issues with cache loaders, so I decided not to 
use them *at all*, in favor of manual preloading, listeners for persisting 
changes, and cache replication with memory state transfer.
This has worked pretty well, however we're running into problems when trying to 
ensure failover and add/remove caches in a running cluster. It seems that JBC 
has a lot of built-in functionality (related to cache loaders) for dealing with 
this kind of situations, so it seems difficult and somewhat pointless to 
rewrite these features using different mechanisms. Therefore I'm (reluctantly) 
looking again at using a cache loader.

Before I can do that, I need to understand some details about how cache loaders 
work and what they can/can't do. The idea is to use a custom cache loader that 
uses a database as a persistent store. Here are the most important questions:

1. Is it possible to do reads and writes in batches? Obviously, if I have 1 
million records and I want to preload them all, it's better to do one "SELECT 
*" rather than one "SELECT ID" followed by 1 million "SELECT * WHERE ID=?".
Similarly, if I have 1 million updates to perform, it's better to group them in 
batches (asynchronously), and reduce the number of db transactions.

2. When I add a new cache to the replicated cluster (with a shared cache 
loader), can it preload all the necessary data from the cache loader (not 
blocking the cluster in any way during this operation), and then get the latest 
changes from the cluster (*all* and *only* the changes) so that it is up to 
date?
Specifically:
2.1. Can writes (in the cluster and cache loader) happen while the new cache is 
loading data?
2.2. Can the new cache get from the cluster all the changes that happened while 
it was loading data (from db) and also all the changes that happened before but 
were not flushed yet because of the async operation, but without getting any 
data that it already has (i.e. identical in cache and db)?

3. I understand that with a shared cache loader, the cache that originates a 
change is also the one that writes it to the cache loader. What happens if the 
cache loader writes asynchronously, and that cache instance goes down after 
completing the transaction but before flushing the data to the db? Is it 
possible to have another cache write it instead?

Thanks
Adrian

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105916#4105916

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105916
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to