Support in Erlang/OTP
Several implementations of Kernel Poll are supported since Erlang/OTP R11B-3:
- FreeBSD (kqueue)
- Linux 2.4 (/dev/kpoll)
- Linux 2.6 (/dev/epoll)
- Solaris (/dev/poll)
How to enable Kernel Poll on Erlang/OTP
Short answer:
$ erl +K true Erlang (BEAM) emulator version 5.6.2 [source] [smp:2] [async-threads:0] [kernel-poll:true] Eshell V5.6.2 (abort with ^G) 1>
If Erlang or your system does not support Kernel Poll, this would report an error.
Check the performance tuning page for more details.
How much does it improve performance?
Kernel poll reduces ejabberd's CPU usage when it has hundreds (or more) network connections. It does not affect memory consumption or latency, so if you plan to support great amounts of simultaneous connected users, you really want to have a Jabber server with Kernel Poll support.
An experiment was ran to compare ejabberd performance with and without Kernel Poll support. The environment, tools, process and results are available on the Benchmark page, Test 3.
The next screenshot was taken during the experiment. It shows the ejabberd debug window, Jabsimul window and top. There are 3000 concurrent online users chatting and making roster changes. After 47 minutes of constant stress the ejabberd system process (beam) takes around 5% of CPU usage and nearly 200 megs of RAM.



Debian Etch and kernel poll in Erlang R11B2
Unfortunately, Erlang R11B2 distributed with Debian Etch contains a bug in epoll code that usually results in repeated failures to initiate outgoing s2s connection, such as:
This problem was fixed in Erlang R11B3 (look for "OTP-6344" tag in its changelog).
To fix the problem either disable kernel polling (set the "POLL" option to false in /etc/default/ejabberd) or if you can't live without kernel polling build and install more recept version of Erlang. For instance, R11B3 from the snapshot archive will work. Note that you will also have to rebuild Ejabberd itself with the new erlang-dev package installed.
epoll patch updated for 11B-r1
Hi there,
I have updated this patch so it applies cleanly on the recent release of Erlang 11B-r1.
Until the main page for the epoll patch is updated you can find the patch here: http://f-box.org/~dan/files/erlang-11.2.1-epoll.patch
It has been tested against a Tsung 10000 users test and reduced the load nicely.
Cheers,
Dan.