[rabbitmq-discuss] .NET Client - PublishConfirms and batching Acks
Marty Wasznicky
marty.wasznicky at neudesic.com
Tue Feb 25 20:20:25 GMT 2014
Hello,
I'm using the .NET client and attempting to get performance from using PublishConfirms. To date, I don't see much performance over using the txConfirm model though. Hence, I'm wondering if I'm doing something wrong.
I'm creating the Connection and Model and then calling ConfirmSelect()
Then in a tight loop, I'm publishing messages like so:
lock (this.activeMessagesLock)
{
var deliveryTag = 0UL;
deliveryTag = this.model.NextPublishSeqNo;
this.model.BasicPublish(
this.exchangeName,
message.Header.Topic,
this.properties.Durable,
false,
messageProperties,
body);
this.activeMessages[deliveryTag] = message;
}
On the consumer side I'm doing the following for receiving the messages:
consumerModel = this.connection.CreateModel();
consumerModel.BasicQos(0, 1, false);
var consumer = new QueueingBasicConsumer(consumerModel);
var consumerTag = consumerModel.BasicConsume(
this.queueName,true,
consumer);
while (true)
{
BasicDeliverEventArgs item = null;
if (!consumer.Queue.Dequeue(3000, out item))
{
if (this.terminateThreadConsume.WaitOne(0))
{
connectionClosed = true;
break;
}
continue;
}
if (null == item)
{
continue;
}
consumerModel.BasicAck(item.DeliveryTag, true);
}
Unfortunately this is really slow. Is there some property I'm missing that I can use to increase performance? Since I'm setting the "multiple" flag to True in the BasicAck, I tried to call that on every 100 or 1000th message....but I found if an ack isn't sent, I'm not allowed to read another message off the queue.
Thanks
Confidentiality Notice: This email and any attachments are confidential. If you have received this in error, please let us know by email reply and delete the email and all attachments from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140225/d0c75c9d/attachment.html>
More information about the rabbitmq-discuss
mailing list