[zeromq-dev] zmq context's thread priority
Leonard Michelet
leonard.michelet at openwide.fr
Fri Jul 10 09:54:55 CEST 2015
Hello, I switch to ZeroMQ 4.1.2 because it support options to set custom priority and scheduler for context's thread, but I didn't found any documentation about these options.
Hence, I would like to propose my help to add some text about it on pages http://api.zeromq.org/4-1:zmq-ctx-set and http://api.zeromq.org/4-2:zmq-ctx-set :
ZMQ_THREAD_SCHED_POLICY: Set scheduling policy for I/O threads
The ZMQ_THREAD_SCHED_POLICY argument sets the scheduling policy for internal context's thread pool. This option is not available on windows.
Supported values for this option can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html.
This option only applies before creating any sockets on the context.
ZMQ_THREAD_PRIORITY: Set scheduling priority for I/O threads
The ZMQ_THREAD_PRIORITY argument sets scheduling priority for internal context's thread pool. This option is not available on windows.
Supported values for this option depend on chosen scheduling policy. Details can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html.
This option only applies before creating any sockets on the context.
I tested myself these options and it works fine and as I describe it ^^
It's not available on windows means not available when "ZMQ_HAVE_WINDOWS" is defined.
English is not my main language so critics are welcome.
Nevertheless, I hope my proposal can be a first draft ^^
Regards,
Léonard Michelet.
----- Arnaud Kapp <kapp.arno at gmail.com> a écrit :
> Hello,
>
> Note that this is my understanding of how it works, but I am not a
> core dev so I am not sure. I may be totally wrong.
>
> If the IO thread does not run because of not enough CPU time I guess a
> lot of thing can go wrong. As far as I know, messages go through the
> IO thread for dispatching.
> The I/O thread not running could then could prevent you from both
> sending and receiving message.
>
> As for your second question, I do not know. If your application as
> long running one, you could try to manually change the priority of the
> threads and see if it fixes your problem.
>
>
> On Mon, Jun 8, 2015 at 12:30 PM, Leonard Michelet
> <leonard.michelet at openwide.fr> wrote:
> > Hello, I use ZeroMQ on a Preempt_rt kernel and I have some connection problem on a virtual machine.
> > I run automated tests on this virtual machine and its CPU is quite busy, and I noticed that my real time application, which use zmq, has 2 threads not with real time scheduler, but time shared.
> > These thread are usually in "epoll_wait" kernel's function, and I suppose it's internal thread created by ZeroMQ (I set ZMQ_IO_THREADS to 1).
> > I would like to know what is the purpose of these thread, to understand what symptoms I could have if these thread were never run because of not enough CPU time.
> > Would it prevent me from receiving message? Would it prevent me to send message? Both?
> >
> > And my next question would be : is there a way to set priority on these thread?
> >
> > Thanks for reading.
> > Léonard.
> >
> > P.S : the application set real time priority using pthread_setschedparam which is a per thread setting, so it doesn't change the defaullt priority of new thread, and we would like to avoid setting such a default.
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> --
> Kapp Arnaud - Xaqq
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
More information about the zeromq-dev
mailing list