Skip to content

Small Libevent 2.0 Performance Test

In preparation for CodeCon, Nick and I wanted to see how HTTP performance differs between Libevent 1.4 and Libevent 2.0. HTTP is a good test case as it exercises many of the optimized components. Here is a preliminary result.

The libevent HTTP server is serving 200,000 bytes of content for each request. Apache's benchmark tool ab was used to make 15,000 requests with 40 requests happening in parallel.

  • 1.4.10:
    Requests per second: 1450.79 [#/sec] (mean)
  • 2.0:
    Requests per second: 1961.99 [#/sec] (mean)
  • 2.0 (evbuffer_add_reference):
    Requests per second: 3979.31 [#/sec] (mean)
In Libevent 2.0, the evbuffer interface was rewritten to avoid memory copies where possible. This seems to result in a 35% performance improvement. The evbuffer_add_reference() API allows external memory to be associated with an evbuffer and thus avoids another memory copy. This results in about 100% performance increase. In comparison to Libevent 1.4, this is almost 175% faster.

In the meantime, Nick is working on making IOCP available for Windows.

Trackbacks

No Trackbacks