views:

861

answers:

3

I would like to use Ehcache replicated cache, first as the backend to Hibernate second level cache, second as a cache for any data.

I know how a distributed cache like memcached is working, and I know it can scale to large clusters, but I cannot find how Ehcache replication behaves on large clusters.

  • Has someone a pointer to some information or some kind of benchmark?

I found that many replication strategies can be used, like RMI, JGroups, JMS or Terracotta, and RMI and Terracotta seem the most popular.

  • How do they compare on large clusters?

Will the replication kill my performances as I add many nodes (like several dozens)?

+2  A: 

Have you read the section in the manual about Distributed Caching with ehcache?

There are further chapters on:

matt b
Of course I read the manual, but I did not find how the replication is done: are all nodes updated every time I update the cache on one node?
Jazz
The ehcache docs on this are not really good enough. It tells you how to integrate with the distribution technology, but that's about it.
skaffman
+1  A: 

A good solution to the cluster scaling problem is the notion of "buddy replication", where data is only replicated to each node's neighbours (however you define that), rather to all nodes. You get failover without the scaling issue.

To my knowledge, ehcache doesn't do this. However, JBossCache does, and that also integrates with Hibernate in the same way that ehcache does.

skaffman
A: 

Fully replicated cache will only work if your application is read-mostly. Replicated cache cannot scale; passing the updates to the other nodes will kill your performance. You need partitioned cache with backup replicas. Partitioned caches will linearly scale even for the write-intensive applications.

Try Hazelcast! it is open source (Apache license) transactional, partitioned caching solution for Java. It comes with hibernate second level cache plugin.

Several dozens? No problem. Hazelcast 100 node cluster demo can be found here.

Talip Ozturk