libevent – an event notification library

The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.

libevent is meant to replace the event loop found in event driven network servers. An application just needs to call event_dispatch() and then add or remove events dynamically without having to change the event loop.

Currently, libevent supports /dev/poll, kqueue(2), event ports, POSIX select(2), Windows select(), poll(2), and epoll(4). The internal event mechanism is completely independent of the exposed event API, and a simple update of libevent can provide new functionality without having to redesign the applications. As a result, Libevent allows for portable application development and provides the most scalable event notification mechanism available on an operating system. Libevent can also be used for multi-threaded applications, either by isolating each event_base so that only a single thread accesses it, or by locked access to a single shared event_base. Libevent should compile on Linux, *BSD, Mac OS X, Solaris, Windows, and more.

Libevent additionally provides a sophisticated framework for buffered network IO, with support for sockets, filters, rate-limiting, SSL, zero-copy file transmission, and IOCP. Libevent includes support for several useful protocols, including DNS, HTTP, and a minimal RPC framework.

More information about event notification mechanisms for network servers can be found on Dan Kegel's "The C10K problem" web page.

A mailing list for libevent is now available. Libevent is maintained by Nick Mathewson, Azat Khuzhin and Niels Provos.


Book: Programming with Libevent.
Reference: 1.4.x-stable2.0.x-stable2.1.x-stable.
What's new in: 2.0.x-stable2.1.x-alpha.

Download–Stable releases

These are the ones you probably want for software development, unless you like to track the latest development versions and report bugs in them.

Download release candidates

This is a release candidate. If you find any bugs, please let us know!

Download–Alpha releases

This is alpha code. If you find any bugs, please let us know!

  • libevent-2.1.6-beta.tar.gz ChangeLog
    Released 2016-08-27
    • Changelog to follow.
  • libevent-2.1.5-beta.tar.gz [GPG Sig] ChangeLog
    Released 2015-01-05
    • Changelog to follow.
  • libevent-2.1.4-alpha.tar.gz [GPG Sig] ChangeLog
    Released 2014-03-21
    • Several new utility APIs in libevent core, bufferevents, and evhttp.
    • Detect closes early with EPOLLRDHUP.
    • (Optional) support for buildint with cmake.
    • Bugfixes too numerous to mention.
    • and much more...
  • libevent-2.1.3-alpha.tar.gz [GPG Sig] ChangeLog
    Released 2013-05-01
    • New finalization API with fix for bufferevent deadlock issue.
    • New evdns and evhttp option.
    • Several new unit tests.
    • Bugfixes and portability fixes and build fixes too numerous to mention.
    • and much more...
  • libevent-2.1.2-alpha.tar.gz [GPG Sig] ChangeLog
    Released 2012-11-18
    • Various new functions in the core, evbuffer, and bufferevent APIs
    • Even more backends can now use portable monotonic timers.
    • Updated autotools build infrastructure for faster builds.
    • More reliable unit tests
    • Internal event-callback interface now refactored for flexibility and performance
    • Faster notification with kqueue, faster/more precise timers on Linux
    • Numerous small performance improvements and data structure tweaks throughout the codebase
    • Various bugfixes against 2.1.1-alpha
    • and much more...
  • libevent-2.1.1-alpha.tar.gz [GPG Sig] ChangeLog
    Released 2012-04-03
    • First alpha release in the 2.1.x series.
    • Useful features for controlling the event loop and avoiding priority inversion
    • New debugging features.
    • New evbuffer functionality, including an improved sendfile/mmap wrapper, the ability to add one evbuffer to another, and more ways to avoid needless copies.
    • Numerous small performance improvements and data structure tweaks throughout the codebase.
    • and much more...

Older Releases

Libevent has been released under a 3-clause BSD license. Information on public git access.


Performance comparison using different event notification mechansims in Libevent. We declare interest in a large number of connections of which most are cold and only a few are active.
Benchmarks with one active connection   Benchmarks with 100 active connections
The benchmark measures how long it takes to serve one active connection and exposes scalability issues of traditional interfaces like select or poll.   The benchmark measures how long it takes to serve one hundred active connections that chain writes to new connections until thousand writes and reads have happened. It exercises the event loop several times.

Programs using libevent

The usefulness of libevent API is demonstrated by the following applications:
  • Chromium – Google's open-source web browser (uses Libevent on Mac and Linux)
  • Memcached – a high-performance, distributed memory object caching system
  • Transmission – a fast, easy, and free BitTorrent client
  • NTP – the network time protocol that makes your clock right (uses Libevent in SNTP)
  • tmux – A clean, modern, BSD-licensed terminal multiplexer, similar to GNU screen
  • Tor – an anonymous Internet communication system.
  • libevhtp – A fast and flexible replacement for libevent's http client/server API
  • Prosody – A Jabber/XMPP server written in Lua
  • PgBouncer – Lightweight connection pooler for PostgreSQL
  • redsocks – a simple transparent TCP -> Socks5/HTTPS proxy daemon.
  • Vomit – Voice Over Misconfigured Internet Telephones
  • Crawl – A Small and Efficient HTTP Crawler
  • Libio – an input/output abstraction library
  • Honeyd – a virtual honeynet daemon – can be used to fight Internet worms.
  • Fragroute – an IDS testing tool
  • Nylon – nested proxy server
  • Disconcert – a Distributed Computing Framework for Loosely-Coupled Workstations.
  • Trickle – a lightweight userspace bandwidth shaper.
  • watchcatd – software watchdog designed to take actions not as drastic as the usual solutions, which reset the machine.
  • ScanSSH – a fast SSH server and open proxy scanner.
  • Nttlscan – a network topology scanner for Honeyd.
  • NetChat – a combination of netcat and ppp's chat.
  • Io – a small programming language; uses libevent for network communication.
  • Systrace – a system call sandbox.
  • SpyBye – detect malware on web pages.
  • GreenSQL – an SQL database firewall.
  • dnsscan – a fast scanner for identifying open recursive dns resolvers
  • Kargo Event – a PHP extension for libevent.
  • Scytale – a database encryption tool.

Nick Mathewson
Azat Khuzhin
Niels Provos
(Please do not mail us directly for technical support. Instead, please use the mailing list or the IRC channel.)
Last modified: 29 Jan 2017