[zeromq-dev] zmq_monitor

Paul Colomiets paul at colomiets.name
Thu Sep 13 01:14:55 CEST 2012

Hi Paul,

On Thu, Sep 13, 2012 at 1:39 AM, Justin Cook <jhcook at gmail.com> wrote:
> On Wednesday, 12 September 2012 at 23:16, Paul Colomiets wrote:
>> In my opinion it's wrong to provide callback interface for ZMQ_MONITOR
>> in scripting languages.
>> Thoughts?
> Scripting language is fairly vague. Python is an interpreted language that is used in large codebases. What's wrong with providing a callback for ZMQ_MONITOR?

AFAICS, the callback is called directly in IO handling thread. So it
hurts performance a lot.

And by "scripting language" I mean language with much larger overhead
of calling function than in C, and may be with GIL :)

> MinRK has a valid point. Is it just too much work and/or expensive to put this on sockets and not the context? It makes 100% sense to put this in  individual sockets versus the entire context.

Yes and no. Please describe use cases, to prove the point. For logging
case the context option is better. It's also better to force
developers not doing business logic in the callback.

Providing logging has a side effect of establishing a standard for
logging zeromq errors, and being single setting to turn on, instead of
writing callbacks. It's also future proof in case zeromq will add more
monitor events (pyzmq will add a message and there will be no need to
change an application).

Providing statistics has a benefit of being able to collect statistics
with C (i.e. faster) without writing C code by end user.

So what are use cases for callback?


More information about the zeromq-dev mailing list