[zeromq-dev] detecting messages being dropped on a PUB socket?
Luca Boccassi
bluca at debian.org
Wed Dec 9 12:26:31 CET 2020
On Wed, 2020-12-09 at 11:30 +0100, Francesco wrote:
> 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
https://github.com/zeromq/libzmq/blob/master/doc/zmq_socket_monitor_versioned.txt
> 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.
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20201209/793a57bd/attachment.sig>
More information about the zeromq-dev
mailing list