Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to declare a maximum queue size with AMQP?

Tags:

amqp

As the title says — is it possible to declare a maximum queue size and broker behaviour when this maximum size is reached? Or is this a broker-specific option?

I ask because I'm trying to learn about AMQP, not because I have this specific problem with any specific broker… But broker-specific answers would still be insightful.

like image 900
David Wolever Avatar asked Oct 29 '11 19:10

David Wolever


2 Answers

AFAIK you can't declare maximum queue size with RabbitMQ.

Also there's no such setting in the AMQP sepc:

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

like image 131
old_sound Avatar answered Jan 02 '23 20:01

old_sound


Depending on why you're asking, you might not actually need a maximum queue size. Since version 2.0 RabbitMQ will seamlessly persist large queues to disk instead of storing all the messages in RAM. So if your concern the broker crashing because it exhausts its resources, this actually isn't much of a problem in most circumstances - assuming you aren't strapped for hard disk space.

In general this persistence actually has very little performance impact, because by definition the only "hot" parts of the queue are the head and tail, which stay in RAM; the majority of the backlog is "cold" so it makes little difference that it's sitting on disk instead.

We've recently discovered that at high throughput it isn't quite that simple - under some circumstances the throughput can deteriorate as the queue grows, which can lead to unbounded queue growth. But when that happens is a function of CPU, and we went for quite some time without hitting it.

like image 32
Sam Stokes Avatar answered Jan 02 '23 20:01

Sam Stokes