[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zeromq-dev
Subject:    Re: [zeromq-dev] pyzmq poller performance
From:       Brian Knox <taotetek () gmail ! com>
Date:       2013-06-25 14:56:07
Message-ID: CAPi=7hNqVdNoLHY2=bGpcc-ANznjvuftRuRrbwU-OJXCyXqDEw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Min - I merged the poll request on my little laptop and gave it a spin.
Before your pull request:

mps: 28066
mps: 28116
mps: 29745
mps: 28912
mps: 28679

after your pull request:

mps: 78138
mps: 78364
mps: 78411
mps: 78065
mps: 78175

Excellent.

By the way, just for fun I imported zmq.green instead of zmq without
changing anything else

mps: 24738
mps: 24779
mps: 24759
mps: 24630
mps: 24702

And it's performance is well below straight zmq Poller.


Thanks for the quick patch!

Brian


On Tue, Jun 25, 2013 at 8:45 AM, Brian Knox <briank@talksum.com> wrote:

> Thanks!  The 4x degradation is within an acceptable range for what we're
> doing and will allow me to keep some things in python for awhile longer.
> I'll patch locally and take it for a test drive today.
>
> Brian
>
>
> On Mon, Jun 24, 2013 at 11:09 PM, MinRK <benjaminrk@gmail.com> wrote:
>
>> From my tests this evening, it looks like zmq_poll does have an
>> appreciable cost (plus the overhead of being wrapped in Python), and will
>> be notably slower than a simple `while True: s.recv()`.  But I did find
>> some inefficiencies in the Poller implementation, which should be addressed
>> by PR #381 <https://github.com/zeromq/pyzmq/pull/381>, bringing the
>> difference closer to 4x from 10x.
>>
>> Your tests on my laptop:
>>
>> pure recv:
>> mps: 241121
>> mps: 419644
>> mps: 413874
>> mps: 434421
>> mps: 428623
>> mps: 404847
>>
>> poll (master):
>> mps: 48544
>> mps: 54143
>> mps: 51642
>> mps: 48888
>> mps: 47591
>> mps: 54218
>>
>> poll (after 381):
>>  mps: 110436
>> mps: 110876
>> mps: 104220
>> mps: 110690
>> mps: 100544
>> mps: 110922
>>
>> -MinRK
>>
>>
>>
>> On Mon, Jun 24, 2013 at 12:18 PM, Brian Knox <briank@talksum.com> wrote:
>>
>>> Thanks Min - additionally if I'm incorrect in my assumption that the
>>> poll look in my example code should perform better, or if there's a better
>>> way to do what I'm doing just let me know.
>>>
>>> The example code polls only one socket (which isn't that useful, hah)
>>> but I wanted to keep the test case dirt simple.  The actual thing I was
>>> working on has one socket that should receive data at a relatively high
>>> rate (say 50k to 100k msgs/s)  , and one socket that receives data at a
>>> much lower rate (say 1 msg/s) (for heartbeating, command and control, etc).
>>>
>>>
>>> Brian
>>>
>>>
>>> On Mon, Jun 24, 2013 at 12:12 PM, Min RK <benjaminrk@gmail.com> wrote:
>>>
>>>> Thanks for the report, I will look into whether I have introduced a
>>>> performance degradation in the last few  iterations.
>>>>
>>>> -MinRK
>>>>
>>>> On Jun 24, 2013, at 11:27, Brian Knox <briank@talksum.com> wrote:
>>>>
>>>> > It's been awhile since I've used pyzmq, and I'm running into a
>>>> performance issue using Poller.poll().
>>>> >
>>>> > With a simple blocking recv() in a while True loop, I get ~ 300k
>>>> messages a second.
>>>> >
>>>> > With the simplest case of the same code using a poll on the socket, I
>>>> get ~ 30k messages a second.
>>>> >
>>>> > (pyzeromq)taotetek@Moya:~/src/performance_example$ python
>>>> ./receiver.py
>>>> > mps: 226049
>>>> > mps: 348582
>>>> > mps: 271728
>>>> > mps: 300389
>>>> > mps: 411059
>>>> > mps: 276749
>>>> >
>>>> > (pyzeromq)taotetek@Moya:~/src/performance_example$ python
>>>> ./poll_receiver.py
>>>> > mps: 28066
>>>> > mps: 28116
>>>> > mps: 29745
>>>> > mps: 28912
>>>> > mps: 28679
>>>> >
>>>> > I don't remember a 10x performance degradation last time I used a
>>>> poller - but perhaps I'm remembering something wrong, or making a painfully
>>>> obvious error in my code .. I've been using czmq from C mostly for the last
>>>> while.
>>>> >
>>>> > I'm using pyzmq from git master, and the latest Cython (0.19.1) with
>>>> libzmq 3.2.3.
>>>> >
>>>> > I've attached the test cases I'm using.
>>>> >
>>>> > <performance_example.tar>
>>>> > _______________________________________________
>>>> > zeromq-dev mailing list
>>>> > zeromq-dev@lists.zeromq.org
>>>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev@lists.zeromq.org
>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>
>>>
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev@lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev@lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div><div>Min - I merged the poll request on my little \
laptop and gave it a spin.  Before your pull request:<br><br>mps: 28066<br>mps: \
28116<br>mps: 29745<br>mps: 28912<br>mps: 28679<br><br></div>after your pull \
request:<br>

<br>mps: 78138<br>mps: 78364<br>mps: 78411<br>mps: 78065<br>mps: \
78175<br><br></div>Excellent.<br><br></div>By the way, just for fun I imported \
                zmq.green instead of zmq without changing anything else<br><br>mps: \
                24738<br>
mps: 24779<br>mps: 24759<br>mps: 24630<br>mps: 24702<br><br></div>And it&#39;s \
performance is well below straight zmq \
Poller.<br><div><div><div><div><br><br></div><div>Thanks for the quick \
patch!<br><br>Brian<br></div></div> </div></div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 25, 2013 at 8:45 AM, \
Brian Knox <span dir="ltr">&lt;<a href="mailto:briank@talksum.com" \
target="_blank">briank@talksum.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Thanks!  The 4x degradation is within an \
acceptable range for what we&#39;re doing and will allow me to keep some things in \
python for awhile longer.  I&#39;ll patch locally and take it for a test drive \
today.<span class="HOEnZb"><font color="#888888"><br>

<br>Brian<br></font></span></div><div class="HOEnZb"><div class="h5"><div \
class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 24, 2013 at 11:09 \
PM, MinRK <span dir="ltr">&lt;<a href="mailto:benjaminrk@gmail.com" \
target="_blank">benjaminrk@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">From my tests this evening, it looks like \
zmq_poll does have an appreciable cost (plus the overhead of being wrapped in \
Python), and will be notably slower than a simple `while True: s.recv()`.  But I did \
find some inefficiencies in the Poller implementation, which should be addressed by \
<a href="https://github.com/zeromq/pyzmq/pull/381" target="_blank">PR #381</a>, \
bringing the difference closer to 4x from 10x.<div>



<br></div><div>Your tests on my laptop:</div><div><br></div><div>pure \
recv:</div><div><div>mps: 241121</div><div>mps: 419644</div><div>mps: \
413874</div><div>mps: 434421</div><div>mps: 428623</div><div>mps: 404847</div></div>



<div><br></div><div>poll (master):</div><div><div>mps: 48544</div><div>mps: \
54143</div><div>mps: 51642</div><div>mps: 48888</div><div>mps: 47591</div><div>mps: \
54218</div></div><div><br></div><div>poll (after 381):</div>


<div>
<div>mps: 110436</div><div>mps: 110876</div><div>mps: 104220</div><div>mps: \
110690</div><div>mps: 100544</div><div>mps: \
110922</div></div><div><br></div><div>-MinRK</div><div><br></div></div><div><div> \
<div class="gmail_extra"><br> <br>
<div class="gmail_quote">On Mon, Jun 24, 2013 at 12:18 PM, Brian Knox <span \
dir="ltr">&lt;<a href="mailto:briank@talksum.com" \
target="_blank">briank@talksum.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">



<div dir="ltr">Thanks Min - additionally if I&#39;m incorrect in my assumption that \
the poll look in my example code should perform better, or if there&#39;s a better \
way to do what I&#39;m doing just let me know.<br><br>



The example code polls only one socket (which isn&#39;t that useful, hah) but I \
wanted to keep the test case dirt simple.  The actual thing I was working on has one \
socket that should receive data at a relatively high rate (say 50k to 100k msgs/s)  , \
and one socket that receives data at a much lower rate (say 1 msg/s) (for \
heartbeating, command and control, etc).<span><font color="#888888"><br>




<br><br>Brian<br></font></span></div><div><div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Mon, Jun 24, 2013 at 12:12 PM, Min RK <span dir="ltr">&lt;<a \
href="mailto:benjaminrk@gmail.com" \
target="_blank">benjaminrk@gmail.com</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Thanks for the report, I will look into whether I have \
introduced a performance degradation in the last few  iterations.<br>





<br>
-MinRK<br>
<div><div><br>
On Jun 24, 2013, at 11:27, Brian Knox &lt;<a href="mailto:briank@talksum.com" \
target="_blank">briank@talksum.com</a>&gt; wrote:<br> <br>
&gt; It&#39;s been awhile since I&#39;ve used pyzmq, and I&#39;m running into a \
performance issue using Poller.poll().<br> &gt;<br>
&gt; With a simple blocking recv() in a while True loop, I get ~ 300k messages a \
second.<br> &gt;<br>
&gt; With the simplest case of the same code using a poll on the socket, I get ~ 30k \
messages a second.<br> &gt;<br>
&gt; (pyzeromq)taotetek@Moya:~/src/performance_example$ python ./receiver.py<br>
&gt; mps: 226049<br>
&gt; mps: 348582<br>
&gt; mps: 271728<br>
&gt; mps: 300389<br>
&gt; mps: 411059<br>
&gt; mps: 276749<br>
&gt;<br>
&gt; (pyzeromq)taotetek@Moya:~/src/performance_example$ python ./poll_receiver.py<br>
&gt; mps: 28066<br>
&gt; mps: 28116<br>
&gt; mps: 29745<br>
&gt; mps: 28912<br>
&gt; mps: 28679<br>
&gt;<br>
&gt; I don&#39;t remember a 10x performance degradation last time I used a poller - \
but perhaps I&#39;m remembering something wrong, or making a painfully obvious error \
in my code .. I&#39;ve been using czmq from C mostly for the last while.<br>





&gt;<br>
&gt; I&#39;m using pyzmq from git master, and the latest Cython (0.19.1) with libzmq \
3.2.3.<br> &gt;<br>
&gt; I&#39;ve attached the test cases I&#39;m using.<br>
&gt;<br>
</div></div>&gt; &lt;performance_example.tar&gt;<br>
&gt; _______________________________________________<br>
&gt; zeromq-dev mailing list<br>
&gt; <a href="mailto:zeromq-dev@lists.zeromq.org" \
target="_blank">zeromq-dev@lists.zeromq.org</a><br> &gt; <a \
href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> \
_______________________________________________<br> zeromq-dev mailing list<br>
<a href="mailto:zeromq-dev@lists.zeromq.org" \
target="_blank">zeromq-dev@lists.zeromq.org</a><br> <a \
href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> \
</blockquote></div><br></div> \
</div></div><br>_______________________________________________<br> zeromq-dev \
mailing list<br> <a href="mailto:zeromq-dev@lists.zeromq.org" \
target="_blank">zeromq-dev@lists.zeromq.org</a><br> <a \
href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> \
<br></blockquote></div><br></div> \
</div></div><br>_______________________________________________<br> zeromq-dev \
mailing list<br> <a href="mailto:zeromq-dev@lists.zeromq.org" \
target="_blank">zeromq-dev@lists.zeromq.org</a><br> <a \
href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> \
<br></blockquote></div><br></div> \
</div></div><br>_______________________________________________<br> zeromq-dev \
mailing list<br> <a href="mailto:zeromq-dev@lists.zeromq.org">zeromq-dev@lists.zeromq.org</a><br>
 <a href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> \
<br></blockquote></div><br></div>



_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic