Slight expansion:<br><br><div>epoll generates events, callbacks, which say that data is waiting.</div><div>poll just iterates the whole list every time</div><div>If you have a lot of "quiet" sockets then epoll wins.</div>
<div>If you have tens of thousands of very active sockets, well, you're going to be "hitting those anyways" so the overhead on poll's wasted checking of quiet sockets is mitigated by the eventing system's overhead with epoll.<br>
<div><br></div><div>At some point those lines do cross.</div><div><br></div><div>That said, most people (>95%?) should use epoll, and when in doubt, measure with each since it's trivial to toggle it on/off.</div><div>
<br></div><div>-mox</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div class="gmail_quote">On Fri, Apr 8, 2011 at 4:52 PM, Bernie Duggan <span dir="ltr"><<a href="mailto:bernie@m5net.com">bernie@m5net.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">It's worth noting that there are certain (relatively unusual) cases where epoll() has significantly worse performance than poll(). The particular case i'm thinking of is where you have a high number of open sockets and, each time (e)poll is called, a significant majority have data waiting on them. This is, as I said, a pretty unusual use pattern, and not something 95% of people will ever strike. But it's worth keeping in mind  that the blanket statement "epoll is always faster/better" is not /always/ true. Of course, in the case I just described, it would be well worth asking whether you need poll/epoll at all, but that's beside my point.<br>

All I'm really saying is that, in the vast majority of cases enabling kernel polling will indeed improve matters, sometimes drastically, but if your application does anything even slightly interesting network-wise then it's well worth measuring rather than assuming.<br>

<br>Cheers,<br><br>B<br><br><div class="gmail_quote">On 9 April 2011 04:12, Kaiduan Xie <span dir="ltr"><<a href="mailto:kaiduanx@gmail.com" target="_blank">kaiduanx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Some OS, for example, Windows, does not have kernel poll support. So<br>
it is not enabled by default.<br>
<br>
On Linux, it uses ePoll and is quite stable. It improves the<br>
performance dramatically if you have a lot of concurrent open sockets.<br>
<font color="#888888"><br>
/Kaiduan<br>
</font><div><div></div><div><br>
On Thu, Apr 7, 2011 at 1:54 AM, Alexey Romanov<br>
<<a href="mailto:alexey.v.romanov@gmail.com" target="_blank">alexey.v.romanov@gmail.com</a>> wrote:<br>
> From reading, e.g.<br>
> <a href="http://developer.sipphone.com/ejabberd/erlang_epoll_patch/" target="_blank">http://developer.sipphone.com/ejabberd/erlang_epoll_patch/</a>, it seems<br>
> supposed to be a performance improvement which only some applications<br>
> can benefit from, but with no downsides. Presumably it's now<br>
> considered stable (after inclusion into OTP and 3 major versions).<br>
> Rebar enables it by default (see<br>
> <a href="https://github.com/basho/rebar/blob/master/priv/templates/simplenode.vm.args" target="_blank">https://github.com/basho/rebar/blob/master/priv/templates/simplenode.vm.args</a>).<br>
> But why is it required to enable it and "+K true" isn't the default?<br>
> Are there circumstances when it's a bad idea to enable it?<br>
><br>
> Yours, Alexey Romanov<br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div>