Tristan Penman's Blog

Implementing a Distributed Hash Table with Scala and Akka

26 November 2015

After diving into Scala and Akka earlier this year, I had been looking for an opportunity to apply what I had learnt to a non-trivial problem. The Chord Protocol seemed like a good place to start, and the project ultimately resulted in a talk at the Melbourne Scala User Group. Slides for my presentation, Implementing a Distributed Hash Table with Scala and Akka, are now available on Slideshare.

Why Chord?

When talking to developers who want to learn about the design of scalable systems, one of the first papers I recommend is Chord: A Scalable Peer-to-peer Lookup Protocol for Internet Applications.

Visualisation of a Chord network: The routing path between nodes A and B. Each hop cuts the remaining distance in half (or better).

This classic paper defines a protocol and a set of algorithms for the implementation of a peer-to-peer Distributed Hash Table. The protocol has its flaws, but for programmers new to the field of Distributed Systems, it is a solid introduction to a number of issues faced in real-world systems.

So, what better way to really explore Akka?

Demo Code

The slides do not include any details from the live demo at the end of the talk, but you can find my Akka-based Chord implementation on GitHub.

The image above was taken from Wikipedia (original), and has been published under the CC BY-SA 3.0 license. No modifications have been made.