Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ: What is the default x-message-ttl value

Tags:

rabbitmq

amqp

I couldn't find in RabbitMQ documentation the default x-message-ttl value comes with the installation.

I know how to set it to a desired value but I am curious to know the default value.

like image 546
Martin Chen Avatar asked Jul 25 '14 00:07

Martin Chen


People also ask

What is X message TTL in RabbitMQ?

RabbitMQ allows you to set TTL (time to live) for both messages and queues. This is controlled by optional queue arguments and best done using a policy. Message TTL can be applied to a single queue, a group of queues or applied on the message-by-message basis. TTL settings also can be enforced by operator policies.

How many messages can RabbitMQ handle per second?

The RabbitMQ message broker was deployed atop Google Compute Engine where it demonstrated the ability to receive and deliver more than one million messages per second (a sustained combined ingress/egress of over two million messages per second).

What is the max message size in RabbitMQ?

While the theoretical message size limit in RabbitMQ is 2GB up to 3.7. 0, we don't recommend sending messages larger than 128MB, which is also the new max size limit in 3.8. 0 and onward. Large messages are especially problematic when using mirrored queues in HA clusters and can cause memory and performance issues.

Does RabbitMQ store messages in memory?

By default, queues keep an in-memory cache of messages that is filled up as messages are published into RabbitMQ. The idea of this cache is to be able to deliver messages to consumers as fast as possible. Note that persistent messages can be written to disk as they enter the broker and kept in RAM at the same time.


1 Answers

There are no x-message-ttl argument set by default from the broker side, so basically you can interpret default value as infinity.

If you publish message without ttl to queue without ttl set (yupp, there are per-message and per-queue ttl arguments, see note below):

  • if message published as persistent and queue declared as persistent message will stay in queue as long as it will not be consumed;

  • if message was not published as persistent or queue was not declared as persistent, then message will stay in queue as long as it will not be consumed or until broker restart.

TTL note:

When both per-message and per-queue ttl set broker use the minimal vale. For example, if per-message ttl is 10000 (10 sec) and per-queue ttl is 20000 (20 sec) then per-message ttl will applied.

Per-message TTL note:

Messages with expired ttl will stay in queue as long as they not reached queue head. Don't worry, they will not be send to consumer, but they will take some resources until they reach head. This is how RabbitMQ queues works (they stick to FIFO idea, which is sometimes may break strict compatibility with AMQP protocol). See Caveats section in Time-To-Live Extensions for more.

like image 180
pinepain Avatar answered Sep 25 '22 21:09

pinepain