libevent

Introduction

Prosody's core task is to handle multiple client or server connections, and handle incoming data from those connections. Monitoring lots of connections for incoming data efficiently isn't a trivial task, and although the standard POSIX API provides select() and poll() for this task, neither scale well for increasing connection counts.

To solve this problem and help people write efficient scalable servers that could make the most of the system's CPU time, many alternative methods started appearing - for example Linux gained 'epoll' and BSD gained 'kqueue'. To avoid having server developers work to add support for each method to their application libevent was created - a library to provide a standard interface across all the different connection monitoring mechanisms.

In 0.7 Prosody gained optional support for libevent, but still uses select() by default which is still adequate for most servers and requires no additional libraries.

Enabling the libevent backend

luaevent

First you need to install luaevent. Information on obtaining luaevent for various platforms can be found on our dependencies page.

Configuration

Next you simply need to add the following line to your configuration file, in the global section:

   use_libevent = true

Restart Prosody and enjoy!

Verification

To check that everything is working, after restarting Prosody you should see a new log line like:

general    info    Prosody is using the epoll backend for connection handling

If it says 'select' then you have a problem. Check libevent is installed properly, or ask us for help.