Byebye RabbitMQ, hello 0MQ!

The core architecture of HouseAgent is build around a messaging system known as RabbitMQ. This worked out fine so far, however during development we discovered a major drawback of RabbitMQ.
RabbitMQ uses Erlang, which is a 70MB download.. *yikes*. In the future I want to be able to run HouseAgent on low memory platforms: for example routers/NAS devices etc. Most of these devices have a maximum of 16MB flash. RabbitMQ is just no option in those scenarios.

Looking for alternatives ZeroMQ caught my eye. A major difference is that ZeroMQ uses a brokerless design whereas RabbitMQ uses a broker based design.
Let’s have a look at both designs:


Old HouseAgent architecture based on RabbitMQ




New HouseAgent architecture based on ZeroMQ

As you can see, there is a major change in architecture. However because we use a central “coordinator” already, that coordinator took over the role of “broker” role as well.
This way the change to ZeroMQ has minimal impact on plugins, or the way HouseAgent works in general. This architecture leaves some space for future high availability/failover scenarios, by implementing a second “coordinator”. I don’t want this post to become a RabbitMQ vs ZeroMQ comparison (just Google if you are looking for that), but I did want to point out this essential change.

So let’s look at the size of ZeroMQ. The size of ZeroMQ is a lot less (being c/c++), the shared library is 1.6MB and can probably be stripped down quite a bit by removing unused features. 70MB-1.6MB = 68,4MB space saving!

The code to implement ZeroMQ is available on Github right now, in the branch “zeromq”. In an upcoming blog post I will post a developers update, to adjust existing plugins so they work with the new system (the changes are minimal, promised!)

Feedback on the new architecture and code is greatly appreciated!