[zeromq-dev] ZeroMQ background threads

Luca Boccassi luca.boccassi at gmail.com
Fri May 19 13:00:03 CEST 2017


On Fri, 2017-05-19 at 12:37 +0200, Francesco wrote:
> However I realized that the API does not provide affinity control,
> which
> can be controlled with the sched_setaffinity() API:
>   https://linux.die.net/man/2/sched_setaffinity
> 
> Could we add a ZMQ_THREAD_AFFINITY option to zmq_ctx_set() ?
> 
> Thanks,
> Francesco

Sure, feel free to send a PR to libzmq.

Should be pretty easy to implement simply copying what it's being done
for the other two options.

Kind regards,
Luca Boccassi

> 2017-05-19 12:25 GMT+02:00 Francesco <francesco.montorsi at gmail.com>:
> 
> > Wow, great, I didn't know about ZMQ_THREAD_SCHED_POLICY and
> > ZMQ_THREAD_PRIORITY, thanks!!
> > 
> > Francesco
> > 
> > 
> > 2017-05-19 12:20 GMT+02:00 Luca Boccassi <luca.boccassi at gmail.com>:
> > > On Fri, 2017-05-19 at 11:58 +0200, Francesco wrote:
> > > > Hi,
> > > > I'm using ZeroMQ in an applications with several threads (up to
> > > > 40).
> > > > I noticed that in the "master" branch of ZeroMQ the background
> > > > threads
> > > > it creates are given a name. That's VERY useful, thanks!
> > > 
> > > No problem. Had the same issue myself. One day I'd like to
> > > further
> > > improve it to have more specific names (I/O, reaper, shutdown),
> > > but it
> > > would require a lot more refactoring so for now all threads have
> > > the
> > > same name.
> > > 
> > > > However my question is: my application sets the affinity and
> > > > the
> > > > priority of all threads it creates explicitly. Of course
> > > > it  cannot
> > > > set the affinity/priority of ZMQ background threads.
> > > > Is it possible to add an API to get the pthread_t (on Linux) or
> > > > the
> > > > generic thread handle (platform-dependent) associated with the
> > > > ZMQ
> > > > background threads?
> > > > 
> > > > In that way my application would be able to set affinity and
> > > > increase
> > > > priority also of ZMQ background threads...
> > > 
> > > There is already an API to set those. Check the manpage for
> > > zmq_ctx_set, and the following options: ZMQ_THREAD_SCHED_POLICY
> > > ZMQ_THREAD_PRIORITY
> > > 
> > > Note that as the manpage says you need to set them before
> > > creating any
> > > socket, immediately after creating the context.
> > > 
> > > Kind regards,
> > > Luca Boccassi
> > > _______________________________________________
> > > zeromq-dev mailing list
> > > zeromq-dev at lists.zeromq.org
> > > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> _______________________________________________
> 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/20170519/20a3a35f/attachment.sig>


More information about the zeromq-dev mailing list