Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best library for Java to grid/cluster-enable your application? [closed]

There are several:

  • Terracotta (open source, based on Mozilla Public License);
  • Oracle Coherence (formerly Tangosol Coherence; commercial; based on JSR 107, which was never adopted officially);
  • GigaSpaces (commercial; based on JavaSpaces API, part of Jini);
  • GridGain, which you mentioned (open source: LGPL);
  • memcached with a Java client library (open source: BSD License;
  • EHCache (open source: Apache Software License;
  • OSCache (open source: modified Apache License; and
  • no doubt several others.

Now I haven't used all of these but I've used or investigated the majority of them.

GridGain and GigaSpaces are more centred around grid computing than caching and (imho) best suited to compute grids than data grids (see this explanation of compute vs data grids). I find GigaSpaces to be a really interesting technology and it has several licensing options, including a free version and a free full version for startups.

Coherence and Terracotta try to treat caches as Maps, which is a fairly natural abstraction. I've used Coherence a lot and it's an excellent high-performance product but not cheap. Terracotta I'm less familiar with. The documentation for Coherence I find a bit lacking at times but it really is a powerful product.

OSCache I've primarily used as a means of reducing memory usage and fragmentation in Java Web applications as it has a fairly neat JSP tag. If you've ever looked at compiled JSPs, you'll see they do a lot of String concatenations. This tag allows you to effectively cache the results of a segment of JSP code and HTML into a single String, which can hugely improve performance in some cases.

EHCache is an easy caching solution that I've also used in Web applications. Never as a distributed cache though but it can do that. I tend to view it as a quick and dirty solution but that's perhaps my bias.

memcached is particularly prevelent in the PHP world (and used by such sites as Facebook). It's a really light and easy solution and has the advantage that it doesn't run in the same process and you'll have arguably better interoperability options with other technology stacks, if this is important to you.


You may want to check out Hazelcast also. Hazelcast is an open source transactional, distributed/partitioned implementation of queue, topic, map, set, list, lock and executor service. It is super easy to work with; just add hazelcast.jar into your classpath and start coding. Almost no configuration is required.

If you are interested in executing your Runnable, Callable tasks in a distributed fashion, then please check out Distributed Executor Service documentation at http://code.google.com/docreader/#p=hazelcast

Hazelcast is released under Apache license and enterprise grade support is also available.


Have you considered Infinispan? It is an open source data grid platform, from JBoss.org. For more details, I recommend you read this (old) blog post announcing the project, along with more interesting blog posts of note, including one on using Infinispan with Hibernate and as a standalone cache. Even more recently, on Red Hat's Enterprise Data Grid. There is a quick "getting started" guide, and a DZone RefCard too, even a YouTube video :)


I think @cletus's summary is pretty good. I did want to mention that Terracotta provides a lot more than just a distributed cache in the form of a map. It clusters Java heap and synchronization primitives, turning a concurrent Java program into a distributed Java program. You can do caching with it (including using distributed versions of open source cache libs) or a bunch of other stuff.

For work distribution, there are some extra libs written on top of Terracotta, in particular the tim-pipes (for messages) and tim-masterworker (for Master-Worker style distribution) are great abstractions on top of Terracotta. This library is on the Terracotta Forge:

  • http://forge.terracotta.org/releases/projects/tim-messaging/

This recently added page may add a bit of additional info in comparison to some other potential data technologies:

  • http://www.terracotta.org/web/display/orgsite/Terracotta+vs+Alternate+Technologies

JPPF is also nice.