[rabbitmq-discuss] RabbitMQ server performance issue (erl.exe)
Yogesh Ketkar
yogimogi at gmail.com
Fri Jan 27 08:52:18 GMT 2012
Hello Simon,
This is how code looks like
main(String[] argv) {
// Read messages from MainQueue
Channel ch = c.createChannel();
ch.basicConsume("MainQueue", false, "", new
MainQueueConsumer(ch));
// Read messages from dynamically declared queues
ExecutorService es = Executors.newFixedThreadPool(tpSize);
Collection<QueueProcessor> vAppProcessorCollection = new
ArrayList<QueueProcessor>();
while(true) {
// Get the queues currently present using
// http://<rabbitmq-server>:55672/api/queues/%2f/
List<String> qs = AMQPUtil.getvAppQueues();
vAppProcessorCollection.clear();
for(String q : qs) {
QueueProcessor p = new QueueProcessor(c, q);
vAppProcessorCollection.add(p);
}
es.invokeAll(vAppProcessorCollection);
}
}
MainQueueConsumer, in handleDelivery does something like
public void handleDelivery() {
// Get Queue name from payload
c.queueDeclare(queueName, true, false, false,
getQueueProperties());
c.queueBind(queueName, exchange, routingKey);
c.basicPublish(exchange, routingKey, props, body);
ch.basicAck(envelope.getDeliveryTag(), false);
}
And QueueProcessor does this in call() method
public Boolean call() {
try {
Channel ch = c.createChannel();
while(true) {
GetResponse r = ch.basicGet(queue, false);
if(r != null) {
// process message
ch.basicAck(r.getEnvelope().getDeliveryTag(), false);
} else break;
}
Util.queueDelete(ch, queue, true, true);
if(ch.isOpen()) ch.close();
} catch(Throwable th) {
BaseUtil.logException(logger, th);
}
}
Just couple of things
- If I don't delete the queue in call() method, things are much better
and I am even able to 50000 messages on MainQueue without much
issues
- Ideally I would like to get rid of while(true) { ... basicGet ... }.
Is there any pattern where I can do
basicConsume() on the dynamically generated queue and
remove the consumer and the queue when number of message on it are 0
regards, Yogesh
On Jan 25, 7:23 pm, Simon MacMullen <si... at rabbitmq.com> wrote:
> On 25/01/12 08:30, Yogesh Ketkar wrote:
>
> > Any clues how to debug this?
>
> That sounds odd. 10k messages should be nothing.
>
> Can you share your code somehow so I can try to replicate this?
>
> Cheers, Simon
>
> --
> Simon MacMullen
> RabbitMQ, VMware
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list