views:

206

answers:

1

Could anyone hint me how to configure SwarmCache for Hibernate to work in cluster (distributed cache)? Probably there are some other alternatives (please, don't suggest JBoss Cache)?

+1  A: 

Actually, I don't know why the Hibernate documentation (see 19.2. The Second Level Cache) doesn't mention them as Cluster Safe but both OSCache and EHCache are usable in clustered environments. Probably because Hibernate doesn't officially supports them. Nevertheless, I know that both do work in distributed environment because I did it with EHCache and Matt Raible did it with OSCache (patching hibernate is recommended though). Check out Matt's blog post OSCache vs. EhCache for Hibernate's 2nd Level Cache, it's very informative.

Back to your question now... It's hard to give you a precise answer as you didn't give much details on your requirements and constraints but take into account that:

  • JGroups is a toolkit for reliable multicast communication (Note that this doesn't necessarily mean IP Multicast, JGroups can also use transports such as TCP).
  • My understanding of the previous point is that using JBoss Cache isn't really excluded (see this matrix for the related JGroups version). So it is an option.
  • SwarmCache seems dead (zero activity since November 2003!) and doesn't have much resources available on the Internet, I wouldn't use it.
  • OSCache (invalidating) supports JGroups and JMS as broadcast protocol. It is an option.
  • EHCache supports Terracotta, RMI, JGroups, JMS, Cache Server as distribution mechanisms and supports both invalidation and replication. It is an option.

Now, without more details (replication vs invalidation? what cache concurrency strategy support do you need? what are your restrictions?), I can't say anything more.

Pascal Thivent