-
Notifications
You must be signed in to change notification settings - Fork 616
Support connection.blocked (coming in RabbitMQ 3.2) #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Following the [json spec](http://hg.rabbitmq.com/rabbitmq-codegen/file/tip/amqp-rabbitmq-0.9.1.json#l153) add these two methods. The client needs to advertise support in the connection extensions for these methods to be sent.
RabbitMQ delivers this method when it activates and deactivates TCP pushback on all connections due to a limited global resource.
Thanks for the heads up. Do you have a link to any discussion around these extensions? I imagine the use case is for server telemetry to identify whether the server is slow or has begun pushback, but what is the expected behavior of the client when it does receive a |
If the app receiving |
Note that connections are blocked only of a Rabbit node is low on a resource (RAM, disk or # of available file descriptors) and you try to publish a message. Connections that only consume are not blocked. |
How would these new methods relate to client and server heartbeats? For example, should the client lib disable the read/write deadline on the TCP connection or heartbeat checks while the connection is blocked? Also, this library presents a blocking interface to both synchronous and asynchronous methods, which could cause a deadlock when responding to
In this library, when the sender is blocked on a In Go, I imagine the application to use something like this to behave properly:
But... if the order, as described above happens, the select loop will be blocked on the Publish before the I feel like I missing something. Can you point me to anything that goes into more depth on how the connections are throttled in relation to when and how the Thanks! |
Heartbeats were originally added as a way to "undo" TCP redelivery by allowing clients to detect failed connections quicker. They are orthogonal to blocking. Other clients simply invoke the provided callaback(s). RabbitMQ throttles connections by not reading from the socket until all alarms clear and it's time to unblock. Does this answer your question? |
Other clients do not perform throttling. I think future versions of some clients can do staged writes, but I don't have any good ideas for in-client throttling. One idea that has been discussed if clients should raise exceptions |
What are outstanding questions on this? |
I'm pretty sure I understand the methods. I hadn't merged the implementation because I was waiting for any further discoveries to emerge. I believe these methods are mostly relevant for asynchronous clients because this lib is designed to propagate pushback for flow control. I would only use the blocked methods for logging as I believe there is a race condition between when the congestion window is closed by the server and when the blocked method arrives. |
They are primarly useful for logging. |
It's just an integration test missing for this PR. The implementation seemed straightforward. |
Is there a good way to exclude a group of tests? I'm happy to port the integration tests we have in other clients but it currently requires running against RabbitMQ tip. |
I'd appreciate a port of the other test.
There is already an integration tag that gets built when a server can be found at the AMQP_URL environment variable. Use The lifecycle of the server isn't currently controlled from the integration tests. Either the lifecycle or tuning of the server would likely be needed for each test. The tests are not being run in parallel. |
@streadway I'm a little stretched on time before RabbitMQ 3.2 ships (should be early next week but don't quote me on this) so perhaps we should merge this and add a test after 3.2 GA is available. On the bright side, a good chunk of my OSS time budget is spent porting RabbitMQ tutorials code to Go ;) |
Great news about the tutorials! I'll merge and look at general test improvements later. |
Support connection.blocked (coming in RabbitMQ 3.2)
This is not an issue but rather a heads up.
There is a new feature in RabbitMQ nightlies that requires client support. Java, .NET, Erlang and Ruby (Bunny, amqp gem) already support it their development branches, with librabbitmq-c and 2 Python clients having some progress on it.
It would be nice if the Go client had support for it before 3.2 comes out (which won't happen for a few more months). I'd be happy to help with it but unfortunately not in the near future.