[rabbitmq-discuss] redelivery after ACK

larry.edelstein at therealreal.com larry.edelstein at therealreal.com
Thu Nov 8 22:43:25 GMT 2012


BTW, this article about EventMachine (http://www.paperplanes.de/2011/4/25/eventmachine-how-does-it-work.html)
 
says that EM.connect disables Nagel:
 

"When you call EM.connect to open a connection to a remote server, the connection will be immediately created, but it may not finish until later. The resulting connection will have a bunch of properties:"
 
[...]


"The Nagle algorithm is disabled to prevent the TCP stack from delaying sending packets by setting TCP_NODELAY on the socket. The operating system wants to buffer output to send fewer packets. Disabling Nagle causes any writes to be sent immediately. As EventMachine does internal buffering, it's preferrable for the data to be really sent when it's eventually written to a socket."
 
-larry
 
-----Original Message-----
From: "Simon MacMullen" <simon at rabbitmq.com>
Sent: Wednesday, November 7, 2012 4:50am
To: "Discussions about RabbitMQ" <rabbitmq-discuss at lists.rabbitmq.com>
Cc: larry.edelstein at therealreal.com
Subject: Re: [rabbitmq-discuss] redelivery after ACK



Hmm.

Acks only matter to the server if it receives them. I wonder if you are 
killing the script after it has sent acks, but before the server has 
received them. That's consistent with what you're seeing re some acks 
getting through when you ack a lot - those are the ones that made it all 
the way to the server before the client was killed.

You may also be running into the Nagle algorithm. Not sure how you would 
disable that for the Ruby gem. Is the author here?

Cheers, Simon

On 07/11/12 03:48, larry.edelstein at therealreal.com wrote:
> Hi folks - I'm new to RabbitMQ. I've got a problem and need some help.
>
> I've posted the question on Stack Overflow at
> http://stackoverflow.com/questions/13262738/redelivery-after-ack, so if
> you want to answer it there, please do! I'll do my best to repost, here,
> any answers I get there, so that rabbitmq-discuss list denizens can also
> see and discuss.
>
> So feel free to go to Stack Overflow, or read it here.
>
>
> Larry Edelstein
>
> Now Answers, Inc.
>
> m (415) 713-9148
>
> ribs at acm.org
>
>
> +++
>
> Why are my RabbitMQ messages being redelivered to my consumer after they
> have been ACKd? I'm new to RabbitMQ; I must be misusing it, or there's
> something wrong perhaps with the Ruby amqp gem.
>
>
> I have a ruby script that subscribes to a queue and acks each message.
> If I let it make it all the way through the messages, the messages
> really do disappear from the queue; they're not redelivered. But if I
> interrupt my script before they're all ACKd, and then start the script
> again, delivery starts anew from the first message.
>
>
> The behavior I'm seeing in code is reflected accurately by the RabbitMQ
> web management interface; the queue has messages, and despite the ACKs,
> they don't disappear.
>
>
> Clue: I put about 5000 messages in the queue. If I let the consumer ACK
> a significant amount, a few messages do actually appear to be removed
> from the queue (contrary to what I said above). I haven't been able to
> nail this phenomenon down.
>
>
> I'm using ruby 1.9.3, RabbitMQ 2.8.7, and the amqp ruby gem 0.9.8. It
> happens with producer and consumer on Ubuntu 12.0.4, or on Mac OS 10.7.4.
>
>
> What the heck??
>
>
> Here's the code for the consumer:
>
>
> # encoding: utf-8
>
> require "rubygems"
>
> require 'amqp'
>
> require 'aws-sdk'
>
> queue_name = "some.queue"
>
> begin
>
> AMQP.start("amqp://localhost:5672") do | connection |
>
> channel  = AMQP::Channel.new(connection)
>
> queue = channel.queue(queue_name, :durable => true)
>
> queue.subscribe(:ack => true) do | metadata, payload |
>
> metadata.ack
>
> end
>
> end
>
> end
>
>
> and here's the producer:
>
>
> # encoding: utf-8
>
> require "rubygems"
>
> require 'amqp'
>
> require 'aws-sdk'
>
> msg = ARGV[0]
>
> queue_name = "some.queue"
>
> begin
>
> AMQP.start("amqp://localhost:5672") do | connection |
>
> channel  = AMQP::Channel.new(connection)
>
> queue    = channel.queue(queue_name, :durable => true)
>
> (1..5000).each do | x |
>
> channel.default_exchange.publish x, :routing_key => queue_name,
> :persistent => true
>
> end
>
> end
>
> end
>
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>


-- 
Simon MacMullen
RabbitMQ, VMware
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121108/c19ff331/attachment.htm>


More information about the rabbitmq-discuss mailing list