简体   繁体   English

Celery:什么时候应该选择 Redis 作为消息代理而不是 RabbitMQ?

[英]Celery: When should you choose Redis as a message broker over RabbitMQ?

My rough understanding is that Redis is better if you need the in-memory key-value store feature, however I am not sure how that has anything to do with distributing tasks?我的粗略理解是,如果您需要内存中的键值存储功能,那么 Redis 会更好,但是我不确定这与分发任务有什么关系?

Does that mean we should use Redis as a message broker IF we are already using it for something else?这是否意味着我们应该使用 Redis 作为消息代理,如果我们已经将它用于其他用途?

I've used both recently (2017-2018), and they are both super stable with Celery 4. So your choice can be based on the details of your hosting setup. 我最近使用过(2017-2018),它们与Celery 4都非常稳定。所以你的选择可以基于你的主机设置的细节。

  • If you must use Celery version 2 or version 3, go with RabbitMQ. 如果您必须使用Celery版本2或版本3,请使用RabbitMQ。 Otherwise... 除此以外...
  • If you are using Redis for any other reason, go with Redis 如果您出于任何其他原因使用Redis,请使用Redis
  • If you are hosting at AWS, go with Redis so that you can use a managed Redis as service 如果您在AWS托管,请使用Redis,以便您可以使用托管Redis作为服务
  • If you hate complicated installs, go with Redis 如果您讨厌复杂的安装,请使用Redis
  • If you already have RabbitMQ installed, stay with RabbitMQ 如果您已经安装了RabbitMQ,请继续使用RabbitMQ

In the past, I would have recommended RabbitMQ because it was more stable and easier to setup with Celery than Redis, but I don't believe that's true any more. 在过去,我会推荐RabbitMQ,因为它比使用Redis更安静,更容易设置Celery,但我不相信这是真的。


Update 2019 更新2019年

AWS now has a managed service that is equivalent to RabbitMQ called Amazon MQ, which could reduce the headache of running this as a service in production. AWS现在有一个托管服务,相当于名为Amazon MQ的RabbitMQ,这可以减少将其作为生产服务运行的麻烦。 Please comment below if you have any experience with this and celery. 如果您对此和芹菜有任何经验,请在下面评论。

The Redis broker gives tasks to workers in a fair round robin between different queues. Redis 代理在不同队列之间以公平的循环方式将任务分配给工作人员。 Rabbit is FIFO always.兔子总是先进先出。 For me, a fair round robin was preferable and I tried both.对我来说,公平的循环赛更可取,我都试过了。 Rabbit seems a tad more stable though.兔子似乎更稳定一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Heroku上部署Redis Celery代理时无法访问 - Redis Celery broker not reachable when deployed on Heroku Celery,RabbitMQ,Redis:Celery消息进入交换,但不排队? - Celery, RabbitMQ, Redis: Celery message enters exchange, but not queue? 在flask-celery应用程序中无法连接到Rabbitmq消息代理 - Cannot connect to rabbitmq message broker in flask-celery application 多个服务器上的django-celery基础架构,代理为redis - django-celery infrastructure over multiple servers, broker is redis 错误:没有这样的选项:-b 在运行 celery 和 redis 作为消息代理时 - Error: No such option: -b while running celery and redis as message broker 使用 Celery 和 RabbitMQ 作为代理与仅使用 RabbitMQ + Pika 进行异步任务,使用一个优于另一个的优势 - Using Celery with RabbitMQ as broker vs using just RabbitMQ + Pika for async tasks, advantages of using one over another 芹菜与redis代理可见性超时 - celery with redis broker visibility timeout 当使用Redis或Rabbitmq时,Celery不会利用所有内核 - Celery doesn't utilize all cores, when using redis or rabbitmq 如何使用 redis 代理从 celery 中删除任务? - how to remove task from celery with redis broker? 用芹菜(Broker redis)在django中实现zeromq发布者 - Implement zeromq publisher in django with celery (Broker redis)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM