[zeromq-dev] detecting messages being dropped on a PUB socket?
Francesco
francesco.montorsi at gmail.com
Wed Dec 9 11:30:42 CET 2020
Hi Luca,
sorry to jump into this thread: but
> We have added queue stats capability to socket monitors last year,
Any documentation is available for this new feature?
I could not find any at http://api.zeromq.org/master:zmq-socket-monitor
Thanks!
Francesco
Il giorno mer 9 dic 2020 alle ore 11:24 Luca Boccassi <bluca at debian.org> ha
scritto:
> On Tue, 2020-12-08 at 22:05 +0100, Arnaud Loonstra wrote:
> > Hey all,
> >
> > I might me missing something but is there any way of detecting messages
> > being dropped due to the high watermark on a PUB socket?
> >
> > It's clear how to do this is on a socket that blocks in the mute state,
> > but dropping message on mute is not?
> >
> > for example:
> >
> > // test hwm
> > sock_t *push = zsock_new(ZMQ_PUB);
> > zsock_t *pull = zsock_new(ZMQ_SUB);
> > zsock_set_rcvhwm(pull, 100);
> > zsock_set_sndhwm(push, 100);
> > zsock_set_sndtimeo(push,0);
> > zsock_bind(push, "inproc://test");
> > zsock_connect(pull, "inproc://test");
> > zsock_set_subscribe(pull, "");
> > zclock_sleep(10);
> > int rc = 0;
> > int count = 0;
> > while( rc == 0 && count < 10000) {
> > rc = zstr_send(push, "BOE");
> > count++;
> > }
> >
> > The count will be 10000 due zstr_send dropping messages but returning 0;
> > If we then receive the buffered messages we wil receive 20 messages
> > (rcvhwm + sndhwm)
> >
> > int count2 = 0;
> > char *m = "";
> > while ( m )
> > {
> > char *m = zstr_recv_nowait(pull);
> > count2++;
> > }
> >
> > Rg,
> >
> > Arnaud
>
> There is no deterministic way, and when you think about the conditions
> that might cause that to happen, it makes sense that there isn't.
>
> We have added queue stats capability to socket monitors last year,
> which will give you some insights - but it's of course asynchronous and
> best-effort, and thus useful for debugging and statistics but not for
> making logic decisions.
> The OS should provide you with data about the state of the underlying
> network interfaces/buffers.
>
> --
> Kind regards,
> Luca Boccassi
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20201209/460a4b50/attachment.htm>
More information about the zeromq-dev
mailing list