将芹菜与RabbitMQ一起用作经纪人,而仅使用RabbitMQ+ PIKA用于异步任务,使用一个任务的优点

发布于 2025-02-11 06:23:23 字数 798 浏览 0 评论 0原文

我目前的辩论是我们是否应该使用皮卡(Pika)坚持使用RabbitMQ实施,还是移至芹菜,如果我们与芹菜一起使用,那么所有优势都会有什么优势。据我所知,芹菜是一个分布式工作队列,可简化任务分布的管理。它使用经纪人(RabbitMQ,redis等)来发送和接收客户端和工人之间的消息,它还可以选择使用诸如redis之类的后端来存储结果。 如果是RabbitMQ是一个消息队列,可用于以异步方式执行作业。最终,如果我们在Python中使用Pika使用Pika并实现它,它将执行相同的工作,即在后台执行长期运行过程。

我在使用芹菜时看到的几个优点是:

  • 可以使用后端(例如redis)存储每个任务的结果。
  • 更容易实现。
  • 还允许添加重试。
  • 是一个分布式的作业队列,可以在多个节点/簇上运行。
  • 诸如花之类的包裹也可用于监视每个任务,其状态,结果,时间和其他一些元数据。
  • 任务链接,

但另一方面,似乎确实限制了我们使用RabbitMQ的某些功能,并且它具有一些限制,例如它会同步与经纪人连接(GitHub上的问题/芹菜/芹菜/问题/3884“ rel =“ nofollow noreferrer”> https://github.com/celery/celery/celery/issues/3884 ) 我很熟悉此问题,这里已经问过为什么要使用芹菜代替兔子?但这似乎并不清楚。

任何帮助将不胜感激。

The debate I am in currently is whether we should stick with RabbitMQ implementation using Pika or move to celery, what all advantages are there if we go with Celery. From what I have understood is Celery is a distributed job queue that simplifies the management of task distribution. It uses broker (RabbitMQ, Redis and so on) for the sending and receiving the message between client and worker, it also can optionally use backend such as Redis to store the results.
Where as RabbitMQ is a message Queue which can be used to perform the Jobs in async manner. Eventually if we use either RabbitMQ and implement it using Pika in python it will do the same Job which is to execute long running processes in background.

The few advantages that I see in using Celery are:

  • Can store result of each task, using backend (such as redis).
  • Easier to implement.
  • Also allows to add retries.
  • Is a distributed job queue, can be run on multiple nodes/clusters.
  • Packages like flower can be used to monitor each task, their states, results, time taken and some other metadata too.
  • Task chaining

But on the other side it seems it does restrict us to use some of the features of RabbitMQ and also it has some limitations like it will connect with broker synchronously (issue on github https://github.com/celery/celery/issues/3884
)
I am familiar with this Question already asked here Why use Celery instead of RabbitMQ? but it does not seem to be clear.

Any help would be highly appreciated.

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

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

发布评论

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

评论(1

壹場煙雨 2025-02-18 06:23:23

嗯...在我看来,就像您在这里比较蚊子和大象。 RabbitMQ+Pika不是不是芹菜的替代品。但是,RabbitMQ+Pika可以帮助您实施(微型)服务,例如芹菜,如果您确实想要的话。

如果将RABBITMQ用作后端,则芹菜(实际上 kombu )将使用与皮卡类似的东西-Celery amqp 项目,与经纪人进行交流。

Erm... it seems to me like you are comparing mosquitoes and elephants here. RabbitMQ+Pika is not a replacement for Celery. However, RabbitMQ+Pika can help you implement a (miniature) service such as Celery, if that is really what you want.

If you use RabbitMQ as backend, Celery (actually kombu) will use something similar to Pika - the celery amqp project, to communicate with the broker.

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