Andrea,
I just tested it, and for the head of the JBC trunk at least, setting a Option
with setCacheModeLocal(true) before the putForExternalRead call prevents
replication for that call. So, JBC exposes an API to allow the behavior you
want.
If you want this behavior for Hibernate's use of
- REPLICATION mode replicates everything is put inside the cache. This is bad
because replicates everything, also objects that have not been modified,
generating unnecessary traffic.
- INVALIDATION mode tags objects that are out of date. This is bad because
objects have to be reloaded into
Andrea,
I agree that what or how things are replicated, cached, or invalidated should
be entirely up to you. However, there are many valid reasons to replicate
read-only data to all nodes of the cache. And there are just as many good
reasons to use an invalidation strategy.
To label one
Caching read-only data is a good thing if it is done locally, but i donĀ“t
understand why should we replicate them to all nodes in the cluster.
Scalability and good performances can be achieved only if we reduce the amount
of informations sent to the channel. So imagine that a transaction
Please read the general hibernate documentation on the second level cache, as
all JBossCache does is provide a replicated data store. Typically you lazily
load a result set that large, unless you have massive amounts of memory.
-Jason
View the original post :
Still, it's a valid question. Even if we're only talking a single entity, the
fact that node A read in the entity doesn't imply that node B wants to have it
in memory. Replicating it takes resources.
For sure I don't see why we'd replicate this if the cache is in INVALIDATE mode
rather than
For the issue of invalidating, see
http://jira.jboss.com/jira/browse/JBCACHE-1027 .
If we could get INVALIDATE_SYNC working well for entities (i.e. stuff we're
working on to allow a different cache for the query cache, which doesn't like
INVALIDATE), then IMO the CacheMode attribute on the
1) Caching read-only data is a good thing, is it not?
2) If it's a read-only transaction, why not replicate when data is fetched?
3) What's stored is up to Hibernate. What's replicated is up to JBoss Cache. To
be honest, I don't really know, though.
View the original post :