Skip to content

A screamingly fast Python WSGI server written in C.

License

Notifications You must be signed in to change notification settings

gorakhargosh/bjoern

 
 

Repository files navigation

bjoern: Fast And Ultra-Lightweight Asynchronous WSGI Server

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.

Why it is Cool

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)

What's not Cool

  • Not HTTP/1.1 capable (yet).

Installing Dependencies

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.

Installation

Make sure all the dependencies mentioned in the previous section are installed before issuing the following command:

pip install bjoern

Usage

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()

Compared with other WSGI servers

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

Yes

gunicorn

Yes

Yes

uWSGI

Yes

meinheld

Yes

$SERVER

Yes

Yes

Yes

About

A screamingly fast Python WSGI server written in C.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 82.9%
  • Python 17.1%