Wildsonet::Hazelcast

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.

Hazelcast is pure Java. JVMs that are running Hazelcast will dynamically cluster. Although by default Hazelcast will use multicast for discovery, it can also be configured to only use TCP/IP for environments where multicast is not available or preferred.

www.hazelcast.com

www.hazelcast.com/documentation.jsp

Status

  • No documentation

  • No tests

Not production ready … experimental … proof of concept.

Configuration

To configure Hazelcast put “hazelcast.config” property filled with the path to Hazelcast configuration file into system properties. For example with Rails, you might want to do something like

java.lang.System.setProperty("hazelcast.config", File.join(Rails.root, "config", "hazelcast.xml"))

Usage

Hazelcast core

Maps

To get map(hash) with the name map_name use

map = Wildsonet::Hazelcast.map(map_name)

now to save to data into the map

map[key] = value

and to get back

map[key]

Queue

To publish a message in a queue

Wildsonet::Hazelcast.queue("name_of_queue").put(message)

and then to retrieve the message

Thread.new do
  while true
    msg = Wildsonet::Hazelcast.queue("name_of_queue").take()
    # Do something with the queue
  end
end

take() blocks current thread until new messages arrives to the queue and returns it. To increase performance more threads may be utilized to take messages from queue.

SessionStore

Rack

#TBD#

Rails

#TBD#

Versions

0.0.5

  • Dejewelerize

  • Rename module to Wildsonet

Contributing to wildsonet-hazelcast

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2010 Marek Jelen. See LICENSE.txt for further details.