[jboss-user] [JBoss Cache: Core Edition] - Re: True Structure of Cache Node?
do-not-reply at jboss.com
Wed Apr 1 10:13:32 EDT 2009
genman is a significant JBoss Cache developer and he commented on it, correctly. :)
Single-key per node is very common. Hibernate Second Level Cache with JBC works that way. JBoss AS EJB3 StatefulSessionBean caching works that way. Some flavors of JBoss AS HttpSession caching work that way.
Whether you put a single key with a coarse grained value object or multiple keys with finer grained value objects depends on how you use the data, particularly how you update it after the initial placement in the cache. Multiple keys allow you to update a single key and just replicate that new value, avoiding re-replicating the other unchanged key/value pairs.
Note that updating/replicating just a single key/value is not advised if other values in the map share references to objects included in the replicated value's object graph. (Example: key "husband" and value Person object, key "wife" and value Person object, both Person objects share a ref to an Address object). This is because when an object is independently replicated, it is independently serialized/deserialized, and on the other cluster nodes shared references are broken (husband and wife no longer have a ref to the same Address object, rather 2 Address objects with -- initially -- the same data.)
If you are using INVALIDATION, multiple keys has no benefit as the invalidation message invalidates the entire node.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222650#4222650
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222650
More information about the jboss-user