Although it may seem strange to store a single value in a Node, fortunately, JBoss Cache is designed to be somewhat efficient at storing a single name-value pair in a Node instance. So try and stick with .
Can anyone comment on [A] and other strategies. Is [A] a recommended approach and is not wastage of node maps?
Anyone from JBoss Cache developer can comment on it? As it is primary concern when building cache
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.