Introduction to Infinispan
Distributed in-memory key/value data grid and cache
What is it?Infinispan is an extremely scalable, highly available key/value data store and data grid platform. It is 100% open source, and written in Java. The purpose of Infinispan is to expose a data structure that is distributed, highly concurrent and designed ground-up to make the most of modern multi-processor and multi-core architectures. It is often used as a distributed cache, but also as a NoSQL key/value store or object database.
How do I use it?
At its core Infinispan exposes a
Cache interface which extends
java.util.Map It is also optionally is backed by a peer-to-peer network architecture to distribute data efficiently across a cluster of servers.
In addition to its core Java API, Infinispan can also be consumed by non-JVM platforms by making use of the Hot Rod protocol, for which client libraries for various platforms exist.
Why would I use it?
Most people use Infinispan for one of two reasons. Firstly, as a cache. Putting Infinispan in front of your database, disk-based NoSQL store or any part of your system that is a bottleneck can greatly help improve performance. Often, however, a simple cache isn't enough - for example if your application is clustered and cache coherency is important to data consistency. A distributed cache can greatly help here.
Infinispan can also be used as a high-performance NoSQL data store. In addition to being in memory, Infinispan can also persist data to a more permanent store. We call this a cache store. Cache stores are pluggable, you can easily write your own, and many already exist for you to use. Learn more about cache stores - and existing implementations you can use today - on the cache stores section of this website.
Yet another common use case is adding clusterability and high availability to frameworks. Since Infinispan exposes a distributed data structure, frameworks and libraries that also need to be clustered can easily achieve this by embedding Infinispan and delegating all state management to Infinispan. This way, any framework can easily be clustered by letting Infinispan do all the heavy lifting.
Where can I learn more?
Visit the Documentation section of this website. Lots of resources - including tutorials, quick start guides, sample code and demos - will help get you on your feet in no time.
What about transactions?
A heated topic among many NoSQL engines. Yes, Infinispan is fully transactional. Infinispan supports both JTA as well as XA standards, and can participate in distributed transactions brokered by a valid JTA transaction manager.
Most distributed data stores find that transactions hurt performance. This is true in some cases, but we feel that in many other cases, transactions are necessary for many business applications. As such, we support transactions but this is optional and can be disabled for greater performance.
Can I use it with Hibernate?
Hibernate exposes a hook for second-level caching when retrieving data from a relational database. Infinispan has a Hibernate second-level cache plug-in to speed up your data lookups from a database. Learn more about it here.
Can I perform searches?
Yes. Infinispan's primary form of data retrieval is a key lookup (
Cache.get(key) ), but we also support powerful indexing and searching over your dataset. Learn more about this here.
What about Map/Reduce?
Even better ! Infinispan allows you to use Java's very powerful Stream API which allows code execution, local to the data, in all of our modes, both local and clustered. In addition to streams, Infinispan also supports distributed code execution where you can move your processing into the grid.
JSR 107 (JCACHE: Temporary Caching for Java), is a standard that the Infinispan development team actively participates in and is a part of the expert group. Infinispan will implement the JSR 107 APIs once these have been finalized. For a preview of the JSR 107 APIs, visit the JSR 107 on GitHub or explore Infinispan's JSR 107 module.