Many consumers on 1 queue. What algorithm RabbitMQ use to send messages?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Many consumers on 1 queue. What algorithm RabbitMQ use to send messages?

Haster
Hi there!

For example, I have 3 consumers on 1 queue.
If I set prefetch_count = 1, then server will use round-robin algorithm:
1st message to consumer1
2nd message to consumer2
3rd message to consumer3
4th message to consumer1 and so on.

But how does strategy changes when prefetch_count !=1? (for example 10)
Will server push 10 messages to consumer1, next 10 to 2 and so on?

And if prefetch_count = 1 but 1st consumer has already processed his message? Will server send new message again to consumer1? Or in any cases next message will be sent to consumer2?
Reply | Threaded
Open this post in threaded view
|

Re: Many consumers on 1 queue. What algorithm RabbitMQ use to send messages?

michaelklishin

2013/9/23 Haster <[hidden email]>

And if prefetch_count = 1 but 1st consumer has already processed his
message? Will server send new message again to consumer1? Or in any cases
next message will be sent to consumer2?

It's round robin between consumers that haven't gone above the basic.qos setting
for their channel. With prefetch > 1 it's just harder to see because you have more
messages in flight.

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Many consumers on 1 queue. What algorithm RabbitMQ use to send messages?

Haster
michaelklishin, so there is no determine algorithm?
And I can't found some formala for calculating which consumer will consume n-message?
Reply | Threaded
Open this post in threaded view
|

Re: Many consumers on 1 queue. What algorithm RabbitMQ use to send messages?

Michael Klishin

On sep 23, 2013, at 9:23 p.m., Haster <[hidden email]> wrote:

> And I can't found some formala for calculating which consumer will consume
> n-message?

In theory you can but given that messages can be requeued and delivering and processing
them rarely takes a fixed amount of time, it will be pretty inaccurate.

MK




_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

signature.asc (506 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Many consumers on 1 queue. What algorithm RabbitMQ use to send messages?

Haster
Thank for replies, guys