Rabbitmq 或 Gearman - 选择作业队列

发布于 2024-08-22 16:29:15 字数 190 浏览 6 评论 0原文

在工作中,我们需要构建一个作业服务器,用于发送电子邮件、构建 PDF、处理一些数据等。显然,我们希望构建某种通用排队系统。我对 Gearman 很熟悉,这正是它试图解决的问题:将工作放入队列中,让工人们来取走它们。然而,我看到很多人提到 Rabbitmq,但不清楚它在这种情况下是如何使用的。

Rabbitmq 是一个构建分布式作业系统的好框架吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

窗影残 2024-08-29 16:29:15

我想说 Gearman 更适合对“作业”进行排队,而 RabbitMQ 更适合对“数据”进行排队。当然,它们实际上是同一件事,但对我来说,如果你想“扇出”要完成的工作,并且工作人员可以独立工作,那么 Gearman 是更好的方法。但如果您尝试将来自多个来源的数据提供给较少的数据使用者,RabbitMQ 是更好的解决方案。

RabbitMQ 的历史,允许 Twitter 接收突发消息负载,并将它们送入只能保持一个连接打开、速率受限且没有重试的旧式 SMS 网关,这说明了此类问题: RabbitMQ 擅长解决问题。

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.

池木 2024-08-29 16:29:15

这完全取决于您想要公开什么语义。在 RabbitMQ 之上实现 Gearman 所做的事情确实很容易,它当然可以将消息“扇出”给独立的工作人员。

但 Gearman 是专为特定目的而打造的。 IIUC,Gearman 是一个处理作业的框架,而不是消息传递系统。还有其他此类框架(例如 Celery)在底层使用 RabbitMQ。这是一篇关于 Celery 的文章,值得一读。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文