Erlang Linux 2.6 Kernel Poll patch

The page contains an experimental patch to enable Kernel Poll for the Erlang interpreter on Linux 2.6 based systems. Use at your own risk.

For Erlang programs that maintain many persistent network connections, the main limiting factor becomes the poll() system call used to determine which network connections have data. The overhead of poll() increases as O(N).

The Erlang interpreter can be compiled to support faster polling interfaces, but none of these are provided with Linux 2.6. Linux 2.6 has a faster polling interface -- epoll. (See epoll(2), epoll_create(2), epoll_ctl(2), and epoll_wait(2)). This patch adds support for the Erlang interpreter to use the epoll interface. This results much greater performance for erlang processes which hold open many network connections.

Instructions:
Download the erlang OTP source code: otp_src_R11B-1.tar.gz

    $ wget http://www.erlang.org/download/otp_src_R11B-1.tar.gz   
Download the epoll patch: otp_src_R11B-1_epoll.patch
    $ wget http://developer.sipphone.com/ejabberd/erlang_epoll_patch/download/otp_src_R11B-1_epoll.patch   
Unpack the source:
    $ tar zxvf otp_src_R11B-1.tar.gz   
Apply the patch:
    $ cd otp_src_R11B-1   
    $ patch -p1 < ../otp_src_R11B-1_epoll.patch   
Configure with the --enable-kernel-poll option:
    $ ./configure --enable-kernel-poll   
Make:
    $ make   
Test:
    $ ./bin/erl +K true   
Install:
    $ sudo make install   

Notes:

  • This requires a Linux 2.6 kernel
  • You must add +K true to erl to enable Kernel Poll.
  • This is an experimental patch. Use at your own risk. Please report any crashes to ejabberd@sipphone.com
  • Max Loparyev provided a version of the patch which patches cleanly on R10B-7
  • The goal if this was to modify the existing Erlang code as little as possible. Because of this, the patch is a bit ugly. (But then the original code was pretty ugly already with #ifdefs)
  • This patch is release under the ERLANG PUBLIC LICENSE
  • DanBUK provided a version of the patch which patches cleanly on R11B-1
  • Patches for older versions of OTP available here


    © 2005 SIPphone.com