Le blog d'Archiloque

Gossip Glomers

Gossip glomers is “A series of distributed systems challenges brought to you by Fly.io” with the participation of Kyle Kingsbury.

These exercises are about implementing some standard distributed systems components, like a key-value store broadcast system. In each case you create a terminal-run server run by a tool called Maelstrom: the exercise tells you which command line to run locally, and depending on it Maelstrom sends commands and listens to the results of your server.

The communication is done with STDIN and STDOUT using a JSON format, which means there a few restrictions on the programming languages you choose.

I like that the challenges provides practical experience on topics I’ve read about but never implemented myself.

But they have two issues:

The first is the focus on Go. The API you have to implement is documented on the JSON level. But some examples ask you to use some external services, like a minimal key-value store. And on the exercises pages these services are only documented via the API of a Go library instead of the JSON one. Depending on your languages of choice, there are demo scripts you can have a look, if you can avoid spoilering yourself and can deal with possibly outdated examples (the Ruby code is in this situation), or you go and read the Go library code and retro-engineer the APIs.

The second is the fact that Maelstrom’s outputs are not intuitive: when a behavior is incorrect you get a list of errors as a serialized Closure structure and must understand what went wrong. For example Maelstrom won’t tell you exactly which one of your responses has a problem. In some cases Maelstrom can also crash or fail to analyze the results, which means scrutinizing the logs until you can figure out what to do.

These issues were painful but surmountable, consider yourself warned.

You can find links to my scripts for all the challenges below. Caveat emptor: the code is not commented and can be sometimes be write-only.

Challenge #1: Echo

Challenge #2: Unique ID generation

Challenge #3: Broadcast

Challenge #4:Grow-only counter

Challenge #5: Kafka-style log

Challenge #6: Totally-available transactions