Thursday, 30 June 2011
Another release candidate for 5.0
A number of important bugs are fixed, details are in JIRA, and you can download the release in the usual place. Please provide feedback on the user forums.
Enjoy, and onward to 5.0.0.Final!
Manik
Friday, 24 June 2011
Infinispan @ jazoon
Monday, 20 June 2011
Another week, another release candidate
In addition to Pete's new grouping API, we also have some changes to the way class loading works, as well as the closure of a host of bugs reported against previous release candidates.
Please provide feedback using the forums, grab the release in the usual place, and report issues on JIRA.
Enjoy
Manik
The Grouping API
Infinispan 5 CR4 (and above) includes a new Grouping API. You can read more in the documentation, but I'll introduce it quickly for you here.
In some cases you may wish to co-locate a group of entries onto a particular node. In this case, the group API will be useful for you.
How does it work?
Infinispan allocates each node a portion of the total hash space. Normally, when you store an entry, Infinispan will take a hash of the key, and store the entry on the node which owns that portion of the hash space. Infinispan always uses an algorithm to locate a key in the hash space, never allowing the node on which the entry is stored to be specified manually. This scheme allows any node to know which nodes owns a key, without having to distribute such ownership information. This reduces the overhead of Infinispan, but more importantly improves redundancy as there is no need to replicate the ownership information in case of node failure.
If you use the grouping API , then Infinispan will ignore the hash of the key when deciding which node to store the entry on, and instead use a hash of the group. Infinispan still uses the hash of the key to store the entry on a node. When the group API is in use, it is important that every node can still compute, using an algorithm, the owner of every key. For this reason, the group cannot be specified manually. The group can either be intrinsic to the entry (generated by the key class) or extrinsic (generated by an external function).
How can I use it?
If you can alter the key class, and the determination of the group is not an orthogonal concern to the key class, then you can simply annotate a method on the key class that will provide the group. For example
class User {
...
String office;
...
int hashCode() {
// Defines the hash for the key, normally used to determine location
...
}
// Override the location by specifying a group, all keys in the same
// group end up with the same owner
@Group
String getOffice() {
return office;
}
}
Of course, you need to make sure your algorithm for computing the key is consistent, and always returns the same group for a key!
Alternatively, if you can't modify the key class, or determination of the group is an orthogonal concern, you can externalise computation of the group to an "interceptor style" class, called a "Grouper". Let's take a look an example of a Grouper:
class KXGrouper implements Grouper{
// A pattern that can extract from a "kX" (e.g. k1, k2) style key
static Pattern kPattern = Pattern.compile("(^k)(\\d)$");
String computeGroup(String key, String group) {
Matcher matcher = kPattern.matcher(key);
if (matcher.matches()) {
String g = Integer.parseInt(matcher.group(2)) % 2 + "";
return g;
} else
return null;
}
ClassgetKeyType() {
return String.class;
}
}
Here, we've had to use a grouper, as we cannot modify the key class (String). Our group is still based upon the key, and established by extracting a part of the key.
Of course, you need to enable grouping support in Infinispan, and configure any groupers. The reference documentation will help you here.
Friday, 17 June 2011
So you want JPA-like access to Infinispan?
So we realised JPA-on-Infinispan was firmly on the roadmap. The original plan was to implement the entire set of JPA APIs from scratch, but this was a daunting and Herculean task. After much discussion with core Hibernate architects and Infinispan contributors Emmanuel Bernard and Sanne Grinovero, we came to a decision that rather than implementing all this from scratch, it served both Infinispan and the community better to fork Hibernate's core ORM engine, and replace the relational database mappings with key/value store mappings. And we get to reuse the mature codebase of Hibernate's session and transaction management, object graph dehydration code, proxies, etc.
And Hibernate OGM (Object-Grid Mapping) was born. After initial experiments and even a large-scale public demo at the JBoss World 2011 Keynote, Emmanuel has officially blogged about the launch of Hibernate OGM. Very exciting times, Infinispan now has a JPA-like layer. :-)
To reiterate a key point from Emmanuel's blog, Hibernate OGM is still in its infancy. It needs community participation to help it grow up and mature. This is where the Infinispan community should step in; consider Hibernate OGM as Infinispan's JPA-like layer and get involved. For more details, please read Emmanuel's announcement.
Enjoy!
Manik
Thursday, 9 June 2011
Keynote of the decade: behind the scenes, an Infinispan perspective
Yes, your iPhone has more grunt :-) And yes, these sub-iPhone devices were running a real data grid!
The purpose of this was to demonstrate the extremely low footprint and overhead Infinispan imposes on your hardware (we even had to run the zero assembly port of OpenJDK, an interpreted-mode JVM, since the processor only had a 16-bit bus!). We also had a server running JBossAS running Andrew's cool visualisation webapp rendering the contents of Grid-B, so people could "see" the data in both grids.
- Data distribution, numOwners = 2
- Async network communication via JGroups
- JTA integration with JBossTS
- Cache listeners to notify applications of changes in data and topology
- The Infinispan Lucene Directory distributing the Lucene index on the grid
So here you can see the recording of the event: http://www.jboss.org/jbw2011keynote or listen to the behind the scenes podcast.