[zeromq-dev] Flow control with router socket

Gyorgy Szekely hoditohod at gmail.com
Thu May 14 09:52:40 CEST 2020


Hi All,

I have a message router that routes messages between different types of
producers and consumers. Socket types are router (message router), dealer
(producer, consumer). Currently if a consumer is not fast enough messages
start to queue up (dealer input queue, router output queue), eventually the
router starts to drop messages to avoid blocking.

I would like to implement some kind of flow control. With plain TCP I can
rely on the built-in flow control: write blocks if consumer is overloaded,
and producers can be sanctioned by not reading their socket.

With ZMQ router/dealer I can detect  if a consumer is slow by receiving
EAGAIN on send, but as far as I understand I can't "slow down" a specific
producer, because router socket does fair queuing. So I have to do
application layer "stop sending" and "continue" messages and send them to
specific producers...

Is there any better way to do this? I would rather not reinvent the wheel,
TCP already has a sophisticated mechanism for this.

Regards,
   Gyorgy Szekely
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200514/a36246d5/attachment.htm>


More information about the zeromq-dev mailing list