A screamingly fast, ultra-lightweight asynchronous WSGI server for CPython, written in C using Marc Lehmann's high performance libev event loop and Ryan Dahl's http_parser.
bjoern
is the fastest, smallest and most lightweight WSGI server out there featuring:
- < 1000 lines of code
- Memory footprint ~ 600KB
- Single-threaded and does not use coroutines or other crap.
- 100% WSGI compliance (except for the write callback design mistake)
- Not HTTP/1.1 capable (yet).
Arch Linux:
pacman -S libev
Ubuntu Linux:
sudo aptitude install libev-dev
Mac OS X (using homebrew):
brew install libev
Other platforms may require installing libev from source.
Make sure all the dependencies mentioned in the previous section are installed before issuing the following command:
pip install bjoern
Using bjoern
is easy. You can run a WSGI application directly using the bjoern.run
function:
bjoern.run(wsgi_application, host, port)
Alternatively, you can run the main event loop separately:
bjoern.listen(wsgi_application, host, port)
bjoern.run()
There are existing servers that attempt to deal with WSGI but perform poorly for the reasons highlighted in this comparison table:
Name | Bloated | Slower | Messy Code |
---|---|---|---|
Fapws3 |
|
||
gunicorn |
|
|
|
uWSGI |
|
||
meinheld |
|
||
$SERVER |
|
|
|