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

Chuck Remes cremes.devlist at mac.com
Fri Feb 3 20:40:46 CET 2012


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





More information about the zeromq-dev mailing list