Closed essen closed 5 years ago
Ideally we should use flow control between this plugin and e.g. channels. STOMP does this, for example, to avoid unbounded (in process) queues with slow consumers.
What I see from the STOMP plugin but also from the MQTT plugin is that when there's no credits, the plugin stops reading from the socket entirely. There is no way in Cowboy to do this currently, so I have not added credit handling to the Web-MQTT plugin yet, and probably won't be able to add it here (in parts also because of SockJS), at least not in this form.
It may be interesting to allow telling Cowboy to not read from the socket in a future release. This could make up for protocols which don't come with flow control (HTTP/2 is the only one with built-in flow control that Cowboy will support). The details of how this should be done are undetermined, if it should be done at all.
Receiving all data and doing flow control on that would require a different strategy, as we can't buffer data indefinitely. There comes a point where we must drop the connection, or some messages, or whatever makes the most sense.
@essen I am very interested in that feature. With lot of slow consumer (either because of consumer itself or slow network) web-stomp processes related memory grows very fast. I can throttle the producer, but I'm afraid that only delaying the issue. Any chance to see this landing in 3.6.x?
I've opened a ticket for Cowboy 2.0. It's still a way off though (and then we need to move RabbitMQ to that version) so don't hold your breath.
Upcoming Cowboy 2.5 version has the required features. The following steps remain to be done:
It's not too far off anymore, maybe 1-2 days of work.
@essen sounds good. We would be happy to move to Cowboy 2.5 in RabbitMQ 3.7.9 or so.
Currently ignored for unknown reasons, I was told that ideally they should be handled.