[erlang-questions] Reasons not to enable kernel poll

Mike Oxford moxford@REDACTED
Sat Apr 9 02:14:42 CEST 2011


Slight expansion:

epoll generates events, callbacks, which say that data is waiting.
poll just iterates the whole list every time
If you have a lot of "quiet" sockets then epoll wins.
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.

At some point those lines do cross.

That said, most people (>95%?) should use epoll, and when in doubt, measure
with each since it's trivial to toggle it on/off.

-mox





On Fri, Apr 8, 2011 at 4:52 PM, Bernie Duggan <bernie@REDACTED> wrote:

> 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.
> 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.
>
> Cheers,
>
> B
>
> On 9 April 2011 04:12, Kaiduan Xie <kaiduanx@REDACTED> wrote:
>
>> Some OS, for example, Windows, does not have kernel poll support. So
>> it is not enabled by default.
>>
>> On Linux, it uses ePoll and is quite stable. It improves the
>> performance dramatically if you have a lot of concurrent open sockets.
>>
>> /Kaiduan
>>
>> On Thu, Apr 7, 2011 at 1:54 AM, Alexey Romanov
>> <alexey.v.romanov@REDACTED> wrote:
>> > From reading, e.g.
>> > http://developer.sipphone.com/ejabberd/erlang_epoll_patch/, it seems
>> > supposed to be a performance improvement which only some applications
>> > can benefit from, but with no downsides. Presumably it's now
>> > considered stable (after inclusion into OTP and 3 major versions).
>> > Rebar enables it by default (see
>> >
>> https://github.com/basho/rebar/blob/master/priv/templates/simplenode.vm.args
>> ).
>> > But why is it required to enable it and "+K true" isn't the default?
>> > Are there circumstances when it's a bad idea to enable it?
>> >
>> > Yours, Alexey Romanov
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://erlang.org/mailman/listinfo/erlang-questions
>> >
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110408/0465fa60/attachment.htm>


More information about the erlang-questions mailing list