72

At work, we need to build a jobs server for things like sending emails, building PDFs, crunching some data, etc. Obviously, we'd like to build on some sort of generic queueing system. I'm familiar with Gearman, and that this is exact problem that it tries to solve: putting jobs on a queue where workers come to pick them up. However, I'm seeing lots of mentions of Rabbitmq and am unclear how it's used in this scenario.

Is Rabbitmq a good framework to build a distributed jobs system on top of?

phoenix24
  • 2,072
  • 2
  • 20
  • 24
brianz
  • 7,268
  • 4
  • 37
  • 44
  • 4
    As a follow up to this I ended up choosing RabbitMQ along with the excellent Carrot/Celery packages and am very happy with my choice. Celery is pretty amazing and remarkably simple once you figure out how you need or want to configure you system. AMQP can be a bit mind bending at first, but Celery does a great job of abstracting many of the complexities away until you're ready to dive in deep. – brianz Jun 25 '11 at 21:29
  • 1
    @alexis The link for pdf processing is broken. Could you please fix that. – ihsan Mar 26 '15 at 10:48
  • 1
    There seems to be a [repost of the article](http://seancribbs.com/tech/2009/12/23/generating-thousands-of-pdfs-on-ec2-with-ruby/) on Sean Crubbs' own page. – Uwe Mesecke May 26 '15 at 19:38

2 Answers2

72

I would say that Gearman is better for queuing "jobs" and RabbitMQ is better for queuing "data". Of course, they are both really the same thing, but the way it works out for me is that if you are trying to "fan out" work to be done, and the workers can work independently, Gearman is the better way to do it. But if you are trying to feed data from a lot of sources down into fewer data consumers, RabbitMQ is the better solution.

The history of RabbitMQ, as something that allowed Twitter to take bursty loads of messages, and feed them into crusty old SMS gateways that could keep only one connection open, were rate limited, and didnt have retries, is illustrative of the kind of problems that RabbitMQ is good at solving.

Mark Atwood
  • 11
  • 1
  • 4
32

It all depends what semantics you want to expose. It's really easy to do what Gearman does on top of RabbitMQ, which can certainly 'fan out' messages to independent workers.

But Gearman is built for purpose. IIUC, Gearman is a framework for processing jobs and not a messaging system as such. There are other such frameworks such as Celery that use RabbitMQ under the hood for that. Here is an article about Celery that is worth reading.

cdeszaq
  • 30,869
  • 25
  • 117
  • 173
alexis
  • 331
  • 2
  • 2
  • 8
    Not only us Celery Python-only, but it actually has the entire Django framework as a dependency. In my experience, it feels as though the author wrote it specifically for his environment to fill his specific needs. Which isn't necessarily a bad thing, but it's not a fair comparison to either Gearman or RabbitMQ itself, both of which are very flexible. – jamieb Feb 18 '10 at 07:58
  • 17
    Holding a grudge? :) Celery is not Python-only, it can work over HTTP, which IMHO is a better model than what gearman uses for multiple language support (implement workers in the languages you want to support). It would be easy to implement celery workers in other languages as well, as celery is really a message protocol, where celeryd just happens to be the Python implementation of it. I don't know where you get the idea that it's not fair to compare Celery to Gearman, but you should read the FAQ - especially http://bit.ly/cSh6Ys + http://bit.ly/cANwUg - and supply us with some new arguments – asksol Feb 18 '10 at 15:21
  • 1
    If it were "really" about better models we would all be using Gopher ...not HTTP :) – Abhishek Dujari Sep 29 '12 at 04:30
  • 1
    Link provided in answer now results in 404. Are you able to update? – Relequestual Nov 25 '14 at 10:57
  • Found an archive of the link here https://web.archive.org/web/20100421082319/http://webcookies.org/blog/2009/09/10/rabbitmq-celery-and-django/ – Tony Apr 20 '16 at 08:45