rabbitmq中的预取计数与无确认有什么区别 [英] What is the difference between prefetch count vs no ack in rabbitmq

查看:24
本文介绍了rabbitmq中的预取计数与无确认有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道 rabbitmq 中的 prefetch count 和 no ack 有什么区别?

I need to know what is the difference between prefetch count vs no ack in rabbitmq ?

还有以下语句有什么区别:-

Also What is the difference between following statements :-

如果我将预取计数设置为 10,是否会创建 10 个消费者线程?或者——

if i set prefetch count say 10 does 10 consumer threads are created ? Or --

如果我注册 10 个 cosumer,它会创建 10 个线程吗?

if i register 10 cosumers will it create 10 threads ?

以上哪个更高效

推荐答案

预取计数:消费者应该从队列中读取多少条消息并保留在内部,而不是一次选择一条消息.

Pre-fetch count: How many messages the consumer should read from queue and kept internally rather than picking one message at a time.

No-Ack:不确认消费者已完成消费消息.

No-Ack: Do not acknowledge back that the consumer is done consuming the message.

这两者都用于微调您的设置

Those both are used to fine tune your set-up

要解决问题的第二部分:如果您将预取计数设置为 10,则不会创建 10 个消费者,但您的单个消费者将一次获取 10 条消息.

To address your second part of the question: If you set prefetch count to 10, 10 consumers won't be created, but your single consumer will fetch 10 messages at a time.

如果你创建 10 个消费者,它很可能会创建 10 个线程(或进程).这完全取决于您如何配置它.不过,您很可能会想要使用线程池

And if you create 10 consumers it will most likely create 10 threads (or processes). It all depends on how you configure it. Most likely you will be wanting to use a thread pool though

这篇关于rabbitmq中的预取计数与无确认有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆