Distributed Caching In 5 Minutes

If you prefer a video demo with coding examples, visit the original blog post at gridgain.blogspot.com.

Distributed In-Memory Caching generally allows you to replicate or partition your data in memory across your cluster. Memory provides a much faster access to the data, and by utilizing multiple cluster nodes the performance and scalability of the application increases significantly.

Majority of the products that do distributed caching call themselves In-Memory Data Grids. On top of simply providing hash-table-like access to your data, a data grid product should provide some combination of the following features:

  • Clustering

  • Distributed Messaging

  • Distributed Event Notifications

  • Distributed ACID Transactions

  • Distributed Locks

  • Distributed Data Queries, possibly using SQL

  • Distributed Data Structures, like Maps, Queues, Sets, etc.

  • Clustered Web Sessions

  • OR-Mapping Integration, including Hibernate

  • Persistent Database Support, like Oracle, MySQL, etc.

Of course the devil is in the details. For example, given the distributed nature of the cluster anything can fail at any point. So a good question to ask is how the failures are handled, especially what if the failures happen during commit. If during commit a cluster can be left in semi-committed state due to failures, it is definitely a problem.

Another example would be queries. Are the predicate queries being supported? Can you do SQL queries, particularly can the SQL Joins be handled? How are the aggregate functions handled, etc.

Simplicity of APIs is very important as well. ConcurrentMap API has become a de facto standard of accessing data stored in distributed caches, but not all the products support it. Also, a good thing to check would be whether other standard data structures are supported. For example, GridGain supports Map, Set, BlockingQueue, AtomicLong, AtomicSequence, CountDownLatch, all in distributed fashion.

And the last, but not least, always check for performance. Load up the cluster and see what the throughput and latencies are, what is the network load on each server, etc. A good benchmarking tool for testing distributed systems is open source Yardstick Framework, available on GitHub.

For a video demo and coding examples, visit the original blog post at gridgain.blogspot.com.