[zeromq-dev] Router/Dealer configuration monopolizes CPU while idle
Mazzaroth M.
taomailings at gmail.com
Sun Nov 20 23:47:47 CET 2016
yes I think know what you're driving at. Didn't know None/-1 was an option
for poll(). Since I know the root cause I will tinker and see if I can have
it -1 wait on the poller for the router. I guess what you're saying is when
the Router receives something I can drop out of the nested While and poll()
on the PULL socket.
On Sun, Nov 20, 2016 at 1:38 PM, Michel Pelletier <
pelletier.michel at gmail.com> wrote:
> I just did a brief scan of your code, but it looks like your controller is
> using poll(0) in two places in a loop. poll(0) will return immediately and
> your code will busy loop around the 'while True' if idle. I think a better
> approach would be to register the router socket with the poller and use
> poll(None) always processing the router socket messages first.
>
> -Michel
>
> On Sun, Nov 20, 2016 at 9:41 AM, Mazzaroth M. <taomailings at gmail.com>
> wrote:
>
>> I have a Router/Dealer setup which is polling on a PULL socket to listen
>> for jobs. It forks 10 Dealer/Worker processes. When I run it with the
>> script below it will use about 20% cpu after about 5 min and then about a
>> minute later use 100% cpu on a ubuntu 16.04 setup. This is all while idle.
>> I'm not sure of the root cause.
>>
>> Controller
>> https://gist.github.com/mazz/f50affc65bbf04a6140e257354b16898
>>
>> Worker
>> https://gist.github.com/mazz/34ba3d98296bf5d013037b6ad48b6cb6
>>
>> import sys
>> from pushpull.models import homedirs
>>
>> sys.path[0:0] = homedirs
>> import actors.controller
>>
>> if __name__ == '__main__':
>> sys.exit(actors.controller.run())
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161120/b05644e0/attachment.htm>
More information about the zeromq-dev
mailing list