Download Android App


Alternate Blog View: Timeslide Sidebar Magazine

Sunday, July 3, 2011

Hazelcast - A simple distributed caching library

Its been a while I explored open source projects in distributed systems area, and interestingly, I had two interesting finds in terms of projects worth exploring - Hazelcast and ElasticSearch. I have seen such projects being implemented in large software companies and I was happy to see feature rich open source projects. So I decided to explore both of them.

From their website: "Hazelcast is an open source clustering and highly scalable data distribution platform for Java, which is: "
  • Lightning-fast; thousands of operations/sec.
  • Fail-safe; no losing data after crashes.
  • Dynamically scales as new servers added.
  • Super-easy to use; include a single jar.
And yes, it keeps the promise. It is very simple to include it in your project and get started.

Some good things that I liked about Hazelcast:
  • Hazelcast is dead simple, it does what it says and performs really well without any configuration overhead. e.g. Nodes discover each over with no configuration.
  • It uses peer-to-peer communication as against client-server (Teracotta's Ehcache) setup.
  • It is a little more than a cache as it provides distributed implementation of map, multimap, queue, topic, lock and executor service.
  • Focus on strong consistency as against eventual consistency (Amazon SQS) i.e. GETs and PUTs are guaranteed to be consistent. I am not sure whether availability or partitioning takes a hit here.
  • Native Java, memcache, REST and C# clients.
  • No external dependencies. Hazelcast uses pure Java including NIO for all peer-to-peer communication.
There is more interesting stuff about HazelCast that I will cover in the next article.
    Getting started: Some sample code snippets are available here.

    Who is using Hazelcast and how?

    Take a look at this article. It talks in detail about caching and processing 2TB Mozilla Crash Reports in memory with Hazelcast. The project lives here.

    In short, Hazelcast is cool!

    Other alternatives worth looking at:
    • Ehcache
    • JBoss Cache
    • OSCache
    • Memcached
    In the coming articles, I will discuss ElasticSearch.

      1 comment:

      1. just an interesting note... Rod Johnson of Spring fame is on the board of both hazelcast and elastic search...

        ReplyDelete