Programming language to choose for implementing distributed message passing algorithms
Asked Answered
B

4

7

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

Bodrogi answered 21/8, 2011 at 18:9 Comment(4)
In my experience, Erlang is really, really well-suited to distributed message passing. I don't know any of the protocols you've mentioned, but I do think Erlang is good to try for these purposes.Hambletonian
Do not regret later. Erlang has been proven as the future for fault-tolerant distributed systems. Semantics in Erlang have been designed from the start to support the fast prototyping of such algorithmsFolderol
If you know Java and C++, why are you looking for alternatives? If you could explain your reasons, it will help make recommendations.Tody
I agree with @DanielC.Sobral. Go with what you know. I have a couple of systems that use all those algorithms written in Java. I've also seen all those algorithms implemented in C++. Both have been extremely reliable.Competition
G
8

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.
Gerik answered 21/8, 2011 at 18:51 Comment(0)
F
4

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.

Folderol answered 23/8, 2011 at 11:48 Comment(1)
That seems fantastic. Taking a look at the features, I think I should learn this elegant PL after 10 years coding with C++ and java.Monson
E
2

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.

Euphroe answered 22/8, 2011 at 9:25 Comment(0)
M
0

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:

Monson answered 21/8, 2011 at 18:20 Comment(4)
MPI requires an homogeneous cluster of stable machines. It is not suitable for cloudy architecture, where the config is not homogeneous, the latency can vary and you are not sure a machine will be alive. So, it's not the final panacea for distributed computations.Janettajanette
@paradigmatic: Not agreed ! MPI programs can be executed on heterogeneous (HW, OS, PL) environments. Pls pay attention that ajav (the one who has asked) just needs a library to learn message passing by experimenting them in a set of protocols. He is not facing a real cloudy environment such as the one you mentioned. Please also take a look at FT-MPI (icl.cs.utk.edu/ftmpi) for a fault tolerant version of MPI.Monson
Forget Erlang ? this is wrong Advice. An algorithm implemented today may not stand the challenges of today when it's technology was based on challenges of yesterday. Erlang has been battle tested on Scalability, availability and Stability (with a small prototyping time). Compare systems like Riak, Membase, Scalaris, Yaws e.t.c. these systems rely on the stable models built into Erlang and have proven to be reliable against todays challenges. Try Erlang, you will not regretFolderol
@Muzaaya Joshua: Thanks 4 your comments. I am really new to Erlang, but have worked on C++ and Java and MPI for many years. Would you please pass me any introductory materials for Erland to start?Monson

© 2022 - 2024 — McMap. All rights reserved.