Skip to content
aemadrid edited this page Aug 17, 2010 · 4 revisions

RubyHaze

RubyHaze is a little gem that wraps the Java Hazelcast library into a more comfortable Ruby package (in JRuby, of course).

Why Hazelcast?

Because Hazelcast is awesome. Plain and simple. Some of the features that interested me from projects like Maglev (e.g. shared objects) and Riak (e.g. fault tolerance) are possible in a fully distributed fashion:

  • Queues

  • Topics (PubSub)

  • Maps (Hashes)

  • MultiMaps

  • Sets

  • Lists

  • Locks

  • Events

And all that with an enterprise flavor and commercial support (for Java). Find out more in the links page.

Why RubyHaze?

For a long time I looked at JRuby as an amazing project but was put-off a bit by the perception that I would need to be a Java guru to create something worthwhile with it. That’s when I read the eye-opening article by Roja Buck and realized that JRuby was not so distant and that a nice little wrapper could be easily created.

RubyHaze at the moment is in its early infancy but it can provide you with a few niceties from the start:

  • Quick access to the common distributed objects already mentioned.

  • The beginnings of a simple distributed storage layer for JRuby objects (Stored) with SQL-like searching.

  • A small start into skipping all the xml configuration for a builder style config.

  • All packaged in a single gem (athough I might refactor Stored into another gem).

Todo

There is so much more we can do with Hazelcast. Here are some places we can go:

  • Durability: we already have fault tolerance through multiple nodes and backups but there are mechanisms in place to create our own durability strategies. Why not use Riak/CouchDB/MySQL for simple, perdurable storage?

  • Associations: adding has_many/belongs_to ala ActiveRecord or MongoMapper would be nice.

  • Query Builders: we can create predicates using simple strings but something like Sequel’s Person.first(:name => “David”) could be useful.

  • Better Serialization: to support predicate searching we need to create a shadow Java class to write/read our internal data in Hazelcast distributed maps. We need a conversion mapping layer for attributes other than strings, integers, boolean and doubles. DataMapper has a nice way of deling with custom mappings that we could use for inspiration.

Besides working on the RubyHaze library itself I think we can work on creating all kinds of examples from simple chat systems to recreating Resque with Hazelcast. Do you any other project ideas?

Feedback

Please let me know how you like this little project and feel free to ask questions. I will do my best to answer them. I promise!

Clone this wiki locally