Question

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++.

Was it helpful?

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.

OTHER TIPS

Oh yes ! you can start Programming Erlang by looking at these:

  1. Learn You some Erlang for great good
  2. Erlang Book Part 1
  3. Orielly's Erlang Programming Text Book (Francesco Cezarini and Simon Thompson)
  4. Joe Armstrong's Programming Erlang Text Book

Those links above will provide you with resources to all the Erlang programming you may need. I however suggest that you begin with Joe Armstrongs Programming Erlang Text Book, and as you read it, use the website: Learn you some erlang for great good (reference No. 1 above) as a reference for further understanding the data structures.

You can download Erlang from here: Erlang Download official Page.

You may need other links and resources (applications, libraries e.t.c.), most of which are indexed here: Erlang/OTP .com website.

Occasionally, you can always ask any question on Stackoverflow here, or you can search for tools and libraries from sourceforge.

All of those protocols was already implemented in various Erlang projects. See Mnesia, Riak, CouchDB, Scalaris for more details (not all protocols in each project). I can't imagine more friendly environment for this kind of protocol experiments than Erlang.

Have you decided about your message passing library? If you are interested in MPI, both java and C++ editions of it are available.

MPI performs lots of jobs for you, such as broadcasting a message and retrieving the replies, which is essential in your algorithms. As a result, I recommend you to find a proper version of MPI for C++ or Java and kick off the work.

Take a look at:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top