Can I declare the maximum queue size with AMQP?

As the name says - is it possible to declare the maximum queue size and broker behavior when this maximum size is reached? Or is this an option for a broker?

I ask because I'm trying to learn about AMQP, and not because I have this specific problem with any particular broker ... But the specific answers to the broker will still be insightful.

+4
source share
5 answers

AFAIK, you cannot declare the maximum queue size using RabbitMQ.

Also there is no such setting in AMQP sepc:

http://www.rabbitmq.com/amqp-0-9-1-quickref.html#queue.declare

+3
source

Depending on what you are asking, you may not need the maximum queue size. Starting with version 2.0, RabbitMQ will easily save large queues on disk, rather than storing all messages in RAM. Therefore, if you are worried that the broker is crashing because it is running out of resources, this is actually not a big problem in most cases - if you are not tied to a place on your hard drive.

On the whole, this perseverance actually has very little effect on performance, because by definition the only "hot" parts of the line are the head and tail, which remain in RAM; most of the backlog is β€œcold,” so it’s not much different from sitting on the disk instead.

Recently, we found that with high throughput, this is not so simple - in some circumstances, throughput may deteriorate as the queue grows, which can lead to unlimited growth in the queue. But when this happens, this is a processor function, and for a long time we walked on it without a blow.

+4
source

With qpid, yes you can limit the size of the maxim queue and the policy in case of a maximum increase. The ring, ignore the message, broke the connection. you also have lvq queues (las value) very customizable

+1
source

You can read about the implementation of the maximum RabbitMQ queue here http://www.rabbitmq.com/maxlength.html

They do not block the addition of incoming messages, but they discard messages from the head of the queue.

Here you should definitely read about flow control: http://www.rabbitmq.com/memory.html

+1
source

There are a few things you cannot do with brokers, but you can do this in your application. For example, there are two AMQP methods, basic.get and queue.declare, which return the number of messages in the queue. You can use this to periodically receive the number of outstanding messages and take action (for example, launch new consumer processes) if the number of messages becomes too high.

0
source

All Articles