On 11/10/14 13:22, refik turkeli wrote:
> We normally have around 300 queues in RabbitMQ. Today we noticed that it
> spiked up to 69,000. Majority of those queues are in the form
> amq.gen-***. I know that these are created when a queue is declared with
> an empty routing key.
>
> Our AMQP client is pika and we searched everywhere in our code but found
> no declare with an empty routing key.
>
> I've used the firehose tracer in order to find how these queues are
> being created but there was no log of AMQP commands such as
> "exchange.declare" there.
Yes; the firehose just logs published and delivered messages, not AMQP
commands.
> My question is: how can I trace "exchange.declare" commands and find
> their origin?
Michael L's suggestion of the event exchange is probably easiest of you
can restart the broker. If not, I'd go with Michael K's suggestion of
wireshark.
> Also, to free up memory on that server we are trying to delete queues
> starting with amq.gen-. The way we are doing it is executing the command
> below for every single queue. Every time we execute, it takes about 2
> seconds. If anyone knows a better way in terms of speed, I would
> appreciate it.
>
> rabbitmqadmin --username=*** --password=***** delete queue name=
(I'm guessing that the performance problem here is in the client side by
the way.)
The big problem with using rabbitmqadmin in a loop is that it starts a
Python interpreter each time, and that's expensive. One day I'd like
rabbitmqadmin to get a REPL mode, but that's not going to be a short
term solution.
I suspect the best way to delete lots of queues quickly is to write your
own simple HTTP API client in your favourite programming language. If
that's too much work you could try replacing the rabbitmqadmin delete
queue invocation in whatever shell script you're using with something like:
curl -i -u username:password -H "content-type:application/json" \
-XDELETE
http://server-name:15672/api/queues/%2f/queue-to-delete
since I think curl will start faster than Python.
Cheers, Simon