Wednesday, 19 September 2012
5.2.0.Alpha4 brings cross-site replication into Infinispan!
More about the x-site replication functionality here.
You can download the distribution or the maven artifact. If you have any questions please check our forums, our mailing lists or ping us directly on IRC!
Cheers,
Mircea
Wednesday, 5 September 2012
Infinispan Arquillian Container 1.0.0.CR1 released
It was released as Maven artifacts in JBoss Maven Repository. It is located at http://repository.jboss.org/nexus/content/groups/public-jboss/ . More information on how to set up and use the repo can be found at https://community.jboss.org/wiki/MavenGettingStarted-Users
What does this Arquillian extension offer to you? Let me describe all aspects of this extension one by one.
Developing tests with standalone Infinispan server
When testing, you might want to automatically start the Infinispan server before the test and stop it afterwards. This can be achieved by configuring infinispan-arquillian-container via Arquillian's configuration file. The following is a subset of attributes that can be specified and thus passed to the Infinispan server during startup: masterThreads, workerThreads, cacheConfig, jmxPort, ... The complete list can be found in bit.ly/R7j4d1 (all private fields).
NOTE: Examples are not a part of the release, only libraries are. In order to check out examples provided with the project, one has to clone project's repository: https://github.com/mgencur/infinispan-arquillian-container Examples are located in the respective sub-directory.
The configuration file then looks similar to the following:
Whether these two Infinispan servers are clustered or not depends on the configuration passed to them via cacheConfig (file path) attribute or their default configuration (when no config. file is passed). The configuration in arquillian.xml file just says: "Start these two instances with whatever configuration is passed to them".
Complete example: bit.ly/RkrpEE
When we tell Arquillian to work with Infinispan server, we can inject RemoteInfinispanServer object into our test. Such an object provides various information about the running Infinispan server. For example, we can retrieve a hostname and HotRod port and use these pieces of information to create a RemoteCacheManager instance. Besides that users are allowed to retrieve information available via JMX from the server like cluster size, number of entries in the cache, number of cache hits and many more.
Complete example: http://bit.ly/OaCw8q
Vital dependencies required for the test to run are:
org.infinispan.arquillian.container:infinispan-arquillian-container-managed:jar:1.0.0.CR1:test
org.infinispan.arquillian.container:infinispan-arquillian-impl:jar:1.0.0.CR1:test
Not only with standalone Infinispan server can Infinispan Arquillian extension work.
Developing tests with JBoss Data Grid (JDG) server
This time, the properties in Arquillian's configuration file are different and correspond to properties of JBoss Application Server 7. The most important property is again the path to the server (jbossHome).
Are you interested in what the test looks like? It looks completely the same as tests for standalone Infinispan server, you just have a few more attributes available. JDG server usually starts all three endpoints (HotRod, Memcached, REST) at the same time while for the Infinispan server you have to specify which end point should be started. Furthermore, Infinispan server does not have the REST endpoint available out-of-the-box.
As a result, you can call the following methods with JDG in one single test.
server1.getMemcachedEndpoint().getPort();
server1.getRESTEndpoint().getContextPath();
server1.getHotRodEndpoint().getPort();
The difference is, of course in dependencies. Instead of a handler for standalone Infinispan server, one has to use a handler for JBoss AS 7. The dependencies then look like this:
org.jboss.as:jboss-as-arquillian-container-managed:jar:7.1.2.Final:test
org.infinispan.arquillian.container:infinispan-arquillian-impl:jar:1.0.0.CR1:test
Testing Infinispan libraries
Sometimes we don't want to use a standalone server. Sometimes we want to test just Infinispan in its basic form - Java libraries. Infinispan has been under development for years and during that time, lots of tests were developed. With tests come utility methods. Infinispan Arquillian Container enables you to leverage these utility methods and call them via an instance of DatagridManager. This instance can be easily injected into a test, no matter which test framework (TestNG, JUnit) you use.
DatagridManager class can be found at http://bit.ly/Q0a7ki
Can you see the advantage? No? Let me point out some useful methods available in the manager.
- creates a cluster of caches with certain name and pre-defined configuration
- helps to wait until the cluster is up and running
- retrieves a cache from certain node according to the index
- retrieves a cache with that name
- kills a cache with cacheIndex index
- retrieves an advanced cache from node i
- retrieves a transaction from node i
- retrieves a transaction manager from node i
...and much more.
The following test can be found among other examples in the GIT repository.
Required dependencies:
org.infinispan:infinispan-core:jar:5.1.5.FINAL:test - users should replace this version with the one they want to test
org.infinispan.arquillian.container:infinispan-arquillian-impl:jar:1.0.0.CR1:test
Infinispan Arquillian Container was tested with Infinispan 5.1.5.FINAL and JDG 6.0.0.GA. Nevertheless, it should work smoothly also with other not-very-distinct versions. I'll be updating the project to work with newer versions of both Infinispan and JBoss Data Grid.
Tuesday, 4 September 2012
Speeding up Cache calls with IGNORE_RETURN_VALUES invocation flag
Starting with Infinispan 5.2.0.Alpha3, a new Infinispan invocation flag has been added called IGNORE_RETURN_VALUES.
This flag signals that the client that calls an Infinispan Cache operation () which has some kind of return, i.e. java.util.Map#put(Object, Object) (remember that Infinispan's Cache interface extends java.util.Map), the return value (which in the case of java.util.Map#put(Object, Object) represents the previous value) will be ignored by the client application. A typical client application that ignores the return value would use code like this:
In this example, both cache put call are ignoring the return of the put call, which returns the previous value. In other words, when we cache the last login date, we don't care what the previous value was, so this is a great opportunity for the client code to be re-written in this way:
Or even better:
Thanks to such hints, Infinispan caches can behave in a more efficient way and can potentially do operations faster, because work associated with the production of the return value will be skipped. Such work can on occasions involve network calls, or access to persistent cache stores, so by avoiding this work, the cache calls are effectively faster.
In previous Infinispan versions, a similar effect could be achieved with flags with a narrower target and which are considered too brittle for end user consumption such as SKIP_REMOTE_LOOKUP or SKIP_CACHE_LOAD. So, if you're using either of these flags in your Infinispan client codebase, we highly recommend that from Infinispan 5.2.0.Alpha3 you start using IGNORE_RETURN_VALUES instead.
Cheers, GalderSaturday, 1 September 2012
Infinispan 5.2.0.Alpha3 is out!
- Minimize the interval(s) where the entire cluster can't respond to requests because of a state transfer in progress.
- Minimize the interval(s) where an existing member stops responding to requests because of a state transfer in progress.
- Allow the performance of the cluster to drop during state transfer, but it should not throw any exception
- A new IGNORE_RETURN_VALUES flag to help reduce the number of RPC calls and increasing performance (to be discussed at large by Galder Zamarreño in a following blog post)
- A revamped and much nicer configuration for submodules such as cache loaders. More about it in Tristan Tarrant's blog
- for a complete list of the fixes/enhancements refer to JIRA