[zeromq-dev] PUB/SUB on an epgm socket ... and CPU usage?
Steven McCoy
steven.mccoy at miru.hk
Sat Jul 2 18:20:45 CEST 2011
On 1 July 2011 17:00, Steven McCoy <steven.mccoy at miru.hk> wrote:
> The rate engine can cause a lot of churn as OS sleep calls are not that
> efficient yet. This means some of that CPU usage can be taken away and you
> will see no performance difference.
>
>
One option you may wish to test, if the CPU usage is a greater concern than
accuracy of the rate limiter, is changing the timeout rounding:
In *pgm_socket.cpp* find the timeout conversion for TX and RX sockets:
const long timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
If you want fairer rounding, which might moderately reduce load:
const long timeout = (tv.tv_sec * 1000) + ((tv.tv_usec + 500) / 1000);
If you want rounding up, which significantly helps Windows:
const long timeout = (tv.tv_sec * 1000) + ((tv.tv_usec + 999) / 1000);
It may be worth implementing as a socket option in the future.
--
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110702/3cabdfdf/attachment.htm>
More information about the zeromq-dev
mailing list