High Performance Asynchronous Networking: Weightless

See also the project page weightless.io

Research project

While making DAREnet stand against the slash-dot effect we found that there is something wrong with the threading model used in many web-servers such as Apache. Generally said: at first sight it looks simple and elegant to a programmer, a deeper look reveals many, many nasty issues too complicated to solve for the average programmer. As a result, web-sites use many CPU cycles and memory, yield only moderate performance and show unstable behavior in the presence of lots of traffic.

Weightless draws on the latest technologies to create a High Performance Networking Library, completely new in it's class. The end result being faster systems and -- most notably -- more reliable systems.

New developments

Starting with Python 2.5 and Linux Kernel 2.6.17 a number of interesting features appeared that enable asynchronous I/O as an alternative to replace threads:

"Alternatively, it is possible, but more complicated, to start the communication and then perform processing that does not require that the I/O has completed. This approach is called asynchronous input/output. Any task that actually depends on the I/O having completed ... still needs to wait for the I/O operation to complete, and thus is still blocked, but other processing which does not have a dependency on the I/O operation can continue."

Since one of the main points of interest with asynchronous I/O is eliminating overhead (caused by threads, user/kernel space switching, data buffering) we started a project called Weightless with the aim to use new technology to eliminate all overhead and deliver a High Performance network library.

Results

Weightless has shown to be able to serve more than four thousands HTTP requests per second, filling up a 1 GB network connection, while using about 60% CPU time (on an old PC) and hardly any memory. As of today (oktober 2007) it runs production in various systems. One of them runs a search engine with a SOAP interface on a 128MB Virtual Machine processing 60 concurrent queries (each query being 3 SOAP calls) with about 40% CPU load, while maintaining an average response time of 4-5 seconds as measured at clients at the other end of Europe. That is something we have never seen before, hence we are very satisfied with the results and continue applying Weightless in other contexts.

Seek You Too