Note: This text is from 2013 and contains outdated information. For a more recent blog post, view Caching with JCache.

There is no simple answer to the question of which Java Cache implementation
is the best
. It all depends on the use case:

  • Do you need a local cache only, or do you need a shared cache in an
    application cluster?
  • What’s the trade-off between consistency and latency requirements?
  • Will there be a static deployment on a fixed hardware infrastructure, or an
    elastic deployment with a growing number of application servers?

This page introduces our series on software caches in Java application servers.
In that series, we will introduce
Ehcache, Hazelcast, and
Infinispan and shows their specific
strengths and weaknesses in different deployment scenarios.

Results

  Ehcache Hazelcast Infinispan
Support for Distributed Hash Table architecture in peer-to-peer mode. no yes yes
Support for Fully Replicated architecture in peer-to-peer mode. yes no yes
Guarantee that the cache does never become inconsistent when atomic operations are called in peer-to-peer mode, even when cache is misconfigured? yes yes no
Explicit hardware configuration in client-server mode (configure which hardware units hold back-ups for each other). yes no no
Elastic deployments in client-server mode (grow automatically with the number of servers). no yes yes
Guarantee that the cache does never become inconsistent when atomic operations are called in client-server mode, even when cache is misconfigured? no yes no

Contents