rabbitmq / rabbitmq-web-stomp

Provides support for STOMP over WebSockets
Other
89 stars 26 forks source link

Handle credits/conserve resources #40

Closed essen closed 5 years ago

essen commented 8 years ago

Currently ignored for unknown reasons, I was told that ideally they should be handled.

michaelklishin commented 8 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.

essen commented 8 years ago

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.

JSteunou commented 8 years ago

@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?

essen commented 7 years ago

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.

essen commented 6 years ago

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.

michaelklishin commented 6 years ago

@essen sounds good. We would be happy to move to Cowboy 2.5 in RabbitMQ 3.7.9 or so.