[zeromq-dev] CZMQ guaranteed delivery

Johnny Depp sdusa at hotmail.com
Thu May 14 21:31:29 CEST 2020


Brett,

Thank you for the fast answer. The client/server is actually a push/pull pattern.

What is the meaning of 'HWM'?

Johnny


________________________________
From: Brett Viren
Sent: Thursday, May 14, 2020 6:52 PM
To: Johnny Depp
Cc: zeromq-dev at lists.zeromq.org
Subject: Re: [zeromq-dev] CZMQ guaranteed delivery

Hi Johnny,

Johnny Depp <sdusa at hotmail.com> writes:

>  zstr_send(client, json_string);

This returns an int which -1 will indicate some kind of error.
zstr_send() wraps a lot of functionality so -1 can mean one of a few
things went wrong.  In any case, checking and acting on it would be part
of guaranteeing delivery.

> If the client sends 1000 messages, the server handles them with aplomb
> and all is well. However, if the client sends 10000 messages, about
> 1000 are lost. The client pauses from time to time while sending, but
> the server loses messages.

I guess the change of behavior at 1000 is a likely indication of filling
a socket buffer up to the default HWM of 1000.

> I undrstand that while handling json messages, there is a delay. But
> regardless of that, even if this would be a simple send and receive,
> how can I guarantee delivery? Is there another mechanism or pattern
> that I should employ? Adding more server reading threads would help
> with this? Is there a way of buffering?

You can increase the HWM.  But, that tight send loop likely will always
run faster than the recv loop.  I guess HWM will always eventually be
reached in this test regardless of the HWM.

You don't mention the socket types being used.  If sender "client" means
"CLIENT" then the send loop should block on HWM which by itself should
guarantee eventual delivery.  So, I guess some other socket is being
used.

-Brett.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200514/4884b89b/attachment.htm>


More information about the zeromq-dev mailing list