Skip navigation

Today was a big day in the BOOM group: we launched the alpha version of Bud: Bloom Under Development. If you’re new to this blog, Bloom is our new programming language for cloud computing and other distributed systems settings. Bud is the first fully-functional release of Bloom, implemented as a DSL in Ruby.

I’ve written a lot about Bloom in research papers and on the new Bloom website, and I have lots to say about distributed programming that I won’t recap. Instead, I want to focus here on the tangible: working code. If you’re looking for something serious, check out the walkthrough of the bfs distributed filesystem, a GFS clone. But to get the flavor, consider the following two lines of code, which implement what you might consider to be “hello, world” for distributed systems: a chat server.

nodelist <= connect.payloads
mcast <~ (mcast * nodelist).pairs { |m,n| [n.key, m.val] }

That’s it.

The first line says “if you get a message on a channel called ‘connect’, remember the payload in a table called ‘nodelist'”. The second says “if you get a message on the ‘mcast’ channel, then forward its contents to each address stored in ‘nodelist'”. That’s all that’s needed for a bare-bones chat server.  Nice, right?

The chat client code bootstraps by connecting to the server:

connect <~ [[@server, [ip_port, @nick]]]

and then runs the following logic:

mcast <~ stdio do |s|
   [ip_port, @nick,"%I:%M.%S"), s.line]]
stdio <~ mcast { |m| [pretty_print(m.val)] }

The first statement of this batch takes input from the terminal (‘stdio’), formats it, and sends it to the server on the ‘mcast’ channel.  The second statement takes messages from the ‘mcast’ channel (forwarded by the server) and prints them on the terminal.

Hopefully this little (but working) example gives you a taste of why I’m excited about Bloom: I think it captures the essence of distributed programming in a clean, readable way.  The full implementation is a bit longer, but most of the extra code is simple Ruby boilerplate.

It’s been a blast designing the language and coding up the Bud prototype with my most excellent teammates over the last 9 months.  Hats off, gents.

In subsequent posts I’ll highlight some of the tools we ship with Bud that help with the really hard stuff: using the CALM principle to reason about the consistency and non-determinism of your Bloom code.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: