Infinispan
By Red Hat
Infinispan is an open-source distributed in-memory data grid that stores key-value data across a cluster of nodes to provide low-latency access, horizontal scalability, and optional persistence for applications that need shared state…
Definition
Infinispan is an open-source distributed in-memory data grid that stores key-value data across a cluster of nodes to provide low-latency access, horizontal scalability, and optional persistence for applications that need shared state faster than a traditional disk-based database can provide. It is commonly embedded in Java applications as a caching layer or as the backing store for session state, and it also underlies Red Hat's Data Grid product.
Overview
Infinispan addresses a recurring problem in distributed application design: when an application runs across many server instances, each instance needs fast, consistent access to shared data such as user sessions, computed results, or reference data, and repeatedly hitting a relational database for this is often too slow and creates a bottleneck. Infinispan solves this by holding data in memory across a cluster of nodes, replicating or partitioning it so that any node in the cluster can serve a read or write with memory-speed latency rather than a database round trip. Mechanically, Infinispan organizes data into named caches configured with one of several clustering modes: replicated, where every node holds a full copy of the data for maximum read locality at the cost of memory usage; distributed, where data is partitioned across nodes using consistent hashing so the dataset can exceed any single node's memory; and invalidation, where a shared backing store is the source of truth and Infinispan nodes simply cache and invalidate local copies. It supports optional persistence to a "cache store" such as a filesystem, database, or another key-value store so that data can survive a cluster restart, and it provides transactions, listeners for data change events, and a query capability layered over its indexing engine. Among in-memory grid and caching technologies, Infinispan sits between simple embedded caches like EhCache, which typically run within a single JVM without clustering, and heavier distributed data grids like Pivotal GemFire (built on Apache Geode) or Hazelcast, which target similar distributed use cases with different clustering algorithms and enterprise tooling. Infinispan's open-source, Apache-licensed core and its tight integration with the JBoss/WildFly and Red Hat ecosystem differentiate it from proprietary alternatives, while its clustering protocol (based on JGroups) differs technically from the gossip-based or partition-based approaches used elsewhere. In practice, Java applications embed Infinispan as a library to cache expensive computation results or database query results across a cluster, to store HTTP session state so that any application server node can serve a request without sticky sessions, or to act as a NoSQL-style key-value store for applications that need clustered state without a full database. It is also used as the second-level cache for Hibernate ORM, reducing repeated database hits for frequently read entities. Trade-offs include the operational complexity of running and tuning a distributed cluster, including network partition handling and data rebalancing when nodes join or leave, and the fact that as an in-memory-first system, durability depends on explicitly configuring a persistent cache store rather than being automatic like a disk-based database. Teams needing simple single-node caching are better served by EhCache, while teams needing a full ACID transactional database should not treat Infinispan as a replacement for one, even though it supports transactions within its own scope.
Key Features
- Distributes key-value data across a cluster for horizontal scaling
- Supports replicated, distributed, and invalidation clustering modes
- Provides optional persistence to filesystem, database, or other stores
- Uses consistent hashing to partition data across cluster nodes
- Offers transactions and data-change listeners for cache entries
- Integrates as Hibernate's second-level cache for JPA entities
- Built on the JGroups clustering protocol for node communication
- Forms the technical basis of Red Hat Data Grid