[zeromq-dev] CPU load while polling 0mq sockets

Sergey Malov smalov at mdialog.com
Mon Feb 6 16:33:01 CET 2012


I'll switch to Java binding to avoid possible problems like this. Thank you, guys.

On 2012-02-03, at 5:01 PM, Joshua Foster wrote:

> Polling is supposed to be a non-busy wait so there should not be any CPU 
> usage while waiting on the sockets. I know this works on the Java version.
> 
> Joshua
> 
> On 2/3/2012 4:25 PM, Sergey Malov wrote:
>> I've checked it with different version of Scala 0mq binding, and it behaves as expected: setting polling time to 0.5sec decrease CPU usage to almost zero.
>> It seems version I used before (0.0.4) has a polling bug.
>> 
>> On 2012-02-03, at 2:40 PM, Chuck Remes wrote:
>> 
>>> On Feb 3, 2012, at 1:36 PM, Sergey Malov wrote:
>>> 
>>>> Hi,
>>>> I have an application using three different 0mq socket types:
>>>> - PULL, to receive protocol buffer messages from outside for further processing,
>>>> - PUB, to publish results (in protocol buffer format as well)
>>>> - REPLY, to occasionally answer on status query, etc
>>>> 
>>>> All sockets are being polled in single cycle. It's a Scala application, using scala zeromq binding, and 2.1.11 0mq library.
>>>> What I observe, being idle this app still utilizes more than 100-120% CPU on 4-cores linux box (using top utility). Under "idle" I mean that it is started and polling sockets, but notching is there to pull/publish.
>>>> I played with setting timeout (using setTimeout on poller), latest I've set was to 2000000 microseconds, with no obvious effect on CPU usage. I know that most of the time it spends polling, since I monitor it with profiler.
>>>> 
>>>> Is it normal, such a high CPU utilization? Is there anything wrong with what I'm doing? Something I should check/set ?
>>> Try setting the timeout period to 1 second. If you still see high CPU then it's likely a bug in the Scala or Java binding. With a 1s timeout, cpu utilization should be 0.
>>> 
>>> cr
>>> 
>>> 
>>> _______________________________________________
>>> 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
> 
> _______________________________________________
> 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