Didn't you get the memo?
September 5th, 2007
This article was originally publish on my own blog but some other people thought it was useful so I reproduced it here. Any bad language is representative of me and not New Bamboo who are all very polite chaps/chapettes
With Web 2.0 applications facing growing audiences with data hungry appetites MOM has suddenly had a resurgence.
Messaging systems are a great way of scaling your site by placing operations/messages on a queue and processing them asynchronously. This allows you to get quite imaginative with your architecture and distribute worker processes in geographically disparate locations if you so wished and also distribute/delay the actual processing needs as and when you can.
This can be used with great effect with services such as Amazons own simple messaging offering known as SQS and EC2. As soon as load starts peaking on one EC2 node you can have a script that calls out to a mother-ship to instantiate another EC2 instance and as soon as it’s ‘born’ starts processing messages off the SQS queue. If you wanted you could even have the original load stricken node contact the mother-ship via SQS (probably a more reliable solution). This is one of the architectures I’m currently advocating as EC2 is stateless and rather than worry about database replication across transient nodes, I try and share as much information as I can using messaging and web-services. I’m currently backing off exposing REST style interfaces for non public facing services purely for performance and scaling reasons. Don’t get me wrong, I love REST and for public a public facing API it makes life a lot easier. But as Zed Shaw says, HTTP isn’t exactly the most performant protocol.
I’ve seen people try and achieve similar architectures using a database and their own cobbled together mesh of scripts and while this may work great on small sites, you’re just pushing your scaling issues and problems onto your poor DB. And as anyone who’s had the misfortune to be stuck in a room with me would tell you, I hate relational databases on multiple fronts, they’re so 1980’s and I’ll tell you why in another blog post.
It’s seems these days that we’re currently quite spoiled with the cheap/open messaging solutions that are available. A few years ago most of what I had to play with were proprietary and expensive offerings from various large vendors. A few that I’ve played around with lately have been:
- ActiveMQ – An open source solution utilising STOMP. Check out ActiveMessaging for Ruby/Rails.
- Jabber – While it’s not really intended for reliable delivery of messages, it does have a lot of support and with quite a few Ruby clients available.
- SQS – Amazons offering that is easy to plugin solution if you’re using EC2 as you don’t need to worrying about setting up the messaging infrastructure between distributed nodes that aren’t necessarily sharing a VPN. ActiveMessaging has support for SQS though I kinda feel it’s bit of a chain saw to a bunny rabbit as SQS really is a very simple service as it’s name suggests. I wrote my own lightweight SQS Rails plugin a while ago and will probably dust it off in the next week or so.
- RabbitMQ – Now this is the matrons knockers when it comes to kick ass, ultra fast and scalable messaging. It simply rocks, with performance off the hook. It’s written in Erlang and supports the AMPQ protocol. Unfortunately I haven’t seen much in the way of Ruby support. I’ve played with QPid’s (Apaches own open source AMPQ offering) Ruby client library but haven’t actually tested this against RabbitMQ, so you’re mileage may vary.
So there you have it, messaging. It rocks, it’s sexy and what’s more it’ll make you sexy… Honest guv’nor.
3 Responses to “Didn't you get the memo?”
Sorry, comments are closed for this article.






Interesting post, I’m looking forward to seeing your SQS Rails plugin. I used to use a custom mysql messaging system but switched to Active Messaging and SQS for performance reasons.
Excellent post – couldn’t agree more, even about the ‘chain saw to a bunny’ thing.
We are moving our app onto SQS and EC2 with our next major release (using ActiveMQ in the meantime). I am a big fan of using messaging to distribute work, and EC2 + SQS is a knock-out punch combo.
I knew when I added SQS support to ActiveMessaging that it was sorta overkill. My thought was that I wanted to make it easy to transistion from one broker to another without changing your code – so while there may be more than you need, it is still not much overhead, and gives lovely abstraction from the messaging ins and outs. So far so good – I find it easy to develop against ActiveMQ locally, then move to SQS for production.
I’m actually working on more SQS updates for ActiveMessaging, as more folks (like Alex) adopt it, and come up with good suggestions.
I would be interested to know how many people have adopted AMPQ – I hear alot of talk, but I don’t know anyone using it, so I have neglected adding ActiveMessaging support.
Cheers, Andrew Kuklewicz ActiveMessaging Maintainer
Very interesting indeed…
Just found out about Erlang, and found out that it’s used by RabbitMQ :)