[infinispan-dev] A mechanism for users to control data locality when using DIST

Manik Surtani manik at jboss.org
Mon Mar 22 12:45:13 EDT 2010


So there have been some requests for this ability [1], and although I did blog about some strategies to achieve this [2], one of which Brian plans to employ for HTTP session state in JBoss AS 6, I think this is something generally useful and a simpler "user" solution should be offered.   Annotations won't work for a number of reasons (mainly because this affinity information should be associated with a key instance, not a key class).  So here is what I propose, from an API perspective:

put(K, V) is overloaded with put(K, V, String group).  "group" is an arbitrary, user-defined string, and it is up to the API user to ensure these are unique, and related entries are properly grouped.

Note that this is similar in some ways to another JIRA proposed by Mindaugas Žakšauskas some months ago: ISPN-312 [3].

In terms of implementation, I expect we could add a DataAffinityInterceptor which would:

* for puts, instead of putting (K, V) in the cache, it would put (group, AtomicMap) and (K, group) in the cache, and (K, V) in the AtomicMap.  Similar behaviour for other writes.
* for gets, instead of retrieving (K), from the cache, it would retrieve K to get the group id, and then retrieve the atomic map related to the group before retrieving the key.

The effect of this is to hide the complexities of interacting with AtomicMaps from users by providing a convenience API.

What do people think?

Cheers
Manik

[1] https://jira.jboss.org/jira/browse/ISPN-359
[2] http://infinispan.blogspot.com/2009/08/distribution-instead-of-buddy.html
[3] https://jira.jboss.org/jira/browse/ISPN-312

--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20100322/2ec50e00/attachment-0002.html 


More information about the infinispan-dev mailing list