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!

You can leave a response, or trackback from your own site.

4 Responses to “Byebye RabbitMQ, hello 0MQ!”

  1. Daniel says:

    I like the new architecture Maarten. It recalls me the lack of database server in SQLite.

  2. Whytey says:

    Sounds like a great move and still supported by many languages so plugins can still be in many forms.

  3. […] that this is just what I need. And I’m not the only one that feels that way, as can be seen here and […]

  4. Max Cohan says:

    How has the transition from rabbitmq to 0mq gone?
    I’m currently looking at both (among others) for a project and any real-world feedback would be invaluable.

Leave a Reply