Search code examples
javascalaerlangconsistent-hashingpaxos

Programming language to choose for implementing distributed message passing algorithms


Basically, I would want to implement the following algorithms and analyze how the system built using these algorithms behave under different conditions.

  • Gossip protocol
  • Multiple paxos
  • Consistent hashing

My interest here is in these algorithms. I basically am looking for a programming language that lets me write these algorithms quickly and deeply understand these algorithms.

Which language should I choose? Java, Scala, Erlang or anything else.

Currently, I know Java and C++.


Solution

  • You could try implementing the protocols in Erlang.

    • Process communication is very elegantly baked into the language and VM. Asynchronous message passing between two elrang process whether in the same VM or across VMs in semantically equivalent.
    • Coding in the fault tolerance aspects / retry logic etc. of the algorithm is a breeze in erlang. Encapsulate everything into light weight processes and use special processes called supervisors to restart them.
    • Serializing Erlang objects are really simple. You dont have to explicitly code your Serialization logic (such as implementing Serializable in Java).
    • The Erlang distribution comes with a module called rpc which lets you invoke functions on remote VMs.
    • The Elrang shell is a real god send. You can attach a shell to any remote VM. The shell lets you profile internal tables/data structures. The VM has also extremely sophisticated debugging and tracing features which is available to you via the shell.
    • You can take a look at Riak, an open source NoSQL datastore written in Erlang modelled on Amazon's Dynamo. It implements both Consistent Hashing and the Gossip protocol.