Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens when RabbitMQ's Delivery Tag overflows?

Tags:

rabbitmq

amqp

RabbitMQ uses a non-negative long (63-bit integer, because non-negative only) called a delivery tag to store how many messages have been sent over a channel. What happens if you send (2^63)+1 messages over a channel?

like image 454
Carlos Rendon Avatar asked Oct 24 '13 20:10

Carlos Rendon


People also ask

What is delivery tag in RabbitMQ?

When a consumer (subscription) is registered, messages will be delivered (pushed) by RabbitMQ using the basic. deliver method. The method carries a delivery tag, which uniquely identifies the delivery on a channel. Delivery tags are therefore scoped per channel.

What is consumer tag in RabbitMQ?

A consumer tag is a consumer identifier which can be either client- or server-generated. To let RabbitMQ generate a node-wide unique tag, use a Channel#basicConsume override that doesn't take a consumer tag argument or pass an empty string for consumer tag and use the value returned by Channel#basicConsume.

What is ack and NACK in RabbitMQ?

ack is used for positive acknowledgements. basic. nack is used for negative acknowledgements (note: this is a RabbitMQ extension to AMQP 0-9-1) basic.

Can RabbitMQ have multiple consumers?

In RabbitMQ, we can have multiple consumers listening from one queue. This is good for fast procesing, but not so good for message ordering.


1 Answers

According to my back-of-napkin calculations, assuming a maximum publish rate of 53,710 messages per second, you would have to be publishing for a total of 7.06 x 10^13 years, which is four orders of magnitude greater than the age of the known universe.

Stated a different way, if we assume that somehow you could publish 3 messages per processor cycle, and that the Intel processor could process 7,000,000,000 messages per second, it would still take nearly 84 years.

Therefore, it is safe to conclude you will run into other issues first. But, if your RabbitMQ server manages to stay up and running that long, you deserve a prize.

But in all seriousness, if this were somehow to happen, I imagine it depends on how Erlang handles integers. This post indicates that Erlang will run out of memory - I don't fully understand how they accomplish that, but maybe then the whole system blows up? Who knows. In c#, the ints simply roll after overflow.

like image 168
theMayer Avatar answered Sep 30 '22 17:09

theMayer