Intro To Modeling Evented Systems

There is currently a lot of buzz about building systems based on events, as opposed to threads, for higher throughtput.

As Martin reports, by using events and being smart around reference data and state the developers of LMAX built a very impressive system. Node.js is everywhere, and so is EventMachine. Even languages with a superior concurrency model, like Clojure and Scala, have decent support for events.

I've found that wrapping your head around evented systems, especially evented I/O, is a bit hard for people with no background in Functional Programming (where the function composition patterns match the new model). Even people coming from languages with some flavour of higher-order functions and closures, such as Ruby and JavaScript, have a hard time understanding the differences between the usual thread-per-request model and the way the likes of EvenMachine and Node.js do stuff.

A Silly Example: Take me to Work

Recently I've been using a very simple case to explain how to model software using events.

I live in Berlin, and work for SoundCloud. In the map below you see the distance between my house and our HQ, in Rosenthaler Straße.

Map1

Every day I walk from A to B, it takes around 25 minutes. I really enjoy walking to work, but one big problem for me is this:

Map1

To get to SoundCloud I need to cross Schönhauser Allee Map1 Map1 Map1