• Stars
    star
    2,975
  • Rank 14,548 (Top 0.3 %)
  • Language
    C
  • License
    Other
  • Created about 14 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A screamingly fast Python 2/3 WSGI server written in C.

bjoern: Fast And Ultra-Lightweight HTTP/1.1 WSGI Server

Join the chat at https://gitter.im/jonashaag/bjoern

A screamingly fast, ultra-lightweight WSGI server for CPython 2 and CPython 3, written in C using Marc Lehmann's high performance libev event loop and Ryan Dahl's http-parser.

Why It's Cool

bjoern is the fastest, smallest and most lightweight WSGI server out there, featuring

  • ~ 1000 lines of C code
  • Memory footprint ~ 600KB
  • Python 2 and Python 3 support (thanks @yanghao!)
  • Single-threaded and without coroutines or other crap
  • Can bind to TCP host:port addresses and Unix sockets (thanks @k3d3!)
  • Full persistent connection ("keep-alive") support in both HTTP/1.0 and 1.1, including support for HTTP/1.1 chunked responses

Installation

pip install bjoern. See wiki for details.

Usage

Flask example

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
    return "Hello, World!"

if __name__ == "__main__":
    import bjoern

    bjoern.run(app, "127.0.0.1", 8000)

Advanced usage

# Bind to TCP host/port pair:
bjoern.run(wsgi_application, host, port)

# TCP host/port pair, enabling SO_REUSEPORT if available.
bjoern.run(wsgi_application, host, port, reuse_port=True)

# Bind to Unix socket:
bjoern.run(wsgi_application, 'unix:/path/to/socket')

# Bind to abstract Unix socket: (Linux only)
bjoern.run(wsgi_application, 'unix:@socket_name')

# Enable statsd metrics. See instrumentation.md for details.
bjoern.run(wsgi_application, host, port, statsd=...)

Alternatively, the mainloop can be run separately:

bjoern.listen(wsgi_application, host, port)
bjoern.run()

# With metrics. See instrumentation.md for details.
bjoern.listen(wsgi_application, host, port)
bjoern.run(statsd=...)

You can also simply pass a Python socket(-like) object. Note that you are responsible for initializing and cleaning up the socket in that case.

bjoern.server_run(socket_object, wsgi_application)
bjoern.server_run(filedescriptor_as_integer, wsgi_application)

# This needs manual compilation with `WANT_STATSD=yes`
bjoern.server_run(socket_object, wsgi_application, enable_statsd=True)

More Repositories

1

klaus

docker run klaus / pip install klaus โ€” the first Git web viewer that Just Worksโ„ข.
Python
657
star
2

RealRIRs

Python loaders for many Real Room Impulse Response databases
Python
76
star
3

prometheus-multiprocessing-example

Prometheus Gunicorn multiple worker processes integration example with Flask
Python
62
star
4

django-addanother

"Add another" buttons outside the Django admin
Python
49
star
5

audio-resampling-in-python

Comparison of Python audio resampling implementations
Jupyter Notebook
34
star
6

micromamba-pycharm

Use Micromamba environments in PyCharm
Python
30
star
7

content-security-policy-rules

List of Content Security Policy rules for all major cloud services
22
star
8

speech-enhancement

Collection of papers, datasets and tools on the topic of Speech Dereverberation and Speech Enhancement
Jupyter Notebook
19
star
9

pydct

Short-Time Discrete Cosine Transform (DCT) for Python. SciPy, TensorFlow and PyTorch implementations.
Jupyter Notebook
18
star
10

python-moc

[DISCONTINUED] a Python music on console interface. pip install moc.
Python
14
star
11

Nano

[DISCONTINUED] Nano WSGI Web Framework in ~100 Lines of Code
Python
12
star
12

speech-enhancement-comparison

Comparison of speech enhancement/denoising models
Python
12
star
13

deploy.py

[DISCONTINUED] Dead simple uWSGI + nginx + supervisord + tox deployment based on fabric.
Python
12
star
14

feed2mail

not-that-messy rss2email clone
Python
8
star
15

gpyconf

a modular Python configuration framework with support for multiple backends (ConfigParser, XML, JSON, ...) and multiple frontends (GTK+, Web, ...)
Python
8
star
16

django-ci

[DISCONTINUED] Continuous Integration for Django -- abandoned, feel free to fork
Python
7
star
17

django-indisposable

Disallow disposable email addresses in Django EmailField
Python
7
star
18

german-normalize

Python module to normalize รค รผ รถ รŸ -> a(e) u(e) o(e) ss (DIN 5007)
Python
7
star
19

hosts

[DISCONTINUED] my /etc/hosts file used to block eevil surfing trackers like Google
Shell
7
star
20

WSGITest

General-purpose WSGI server test framework and suite
Python
6
star
21

django-mail-templated-simple

Much simpler, much more cooperative implementation of django-mail-templated
Python
5
star
22

django-nginx-uwsgi-celery-deployment

Django + nginx + uWSGI + Celery deployment example
Python
5
star
23

numpy-fast-align-mse

Python
5
star
24

docker-webfsd

A tiny Alpine Linux based image that contains the webfsd binary
Dockerfile
4
star
25

bip32

BIP32 tools for ETH and BTC
Python
4
star
26

slides

PowerPoint done right!
JavaScript
4
star
27

stupFF

stupid FFmpeg bindings for Python.
Python
4
star
28

xmlserialize.py

An extensible Python-(to|from)-xml-(un)serializer in beautiful pure-Python code
Python
4
star
29

sas7bdat

World's Fastest SAS7BDAT Parser
C++
4
star
30

httpauth

WSGI HTTP Digest Auth middleware
Python
4
star
31

jfx

An ultra tiny Javascript CSS/animation framework.
JavaScript
4
star
32

audible-scraper

Shell
3
star
33

mediainfo

Tiny Python binding for MediaInfo (mediainfo.sf.net)
Python
3
star
34

blip.tv-download

3
star
35

youtube-dl-web

Simple web interface for youtube-dl
Python
3
star
36

dotfiles

~ config files
Lua
3
star
37

limited

A kinda flexible blog system (with a bad architecture) written in Python using django.
Python
3
star
38

checkin.py

Dead simple time tracking tool I have been using for the last 5 years.
Python
3
star
39

todo

[Demo below] a dead simple TODO list application for modern browsers with localStorage support
3
star
40

themissingeditor

The Missing Editor. Written in Python.
2
star
41

django-nonrel-nohistory

make frequent pulls less painful
Python
2
star
42

cparser

C
2
star
43

paperswithcode-speech-enhancement-audiosamples

Audio samples for papers on Papers With Code
2
star
44

interviewquestions

http://maxnoy.com/interviews.html
C
2
star
45

gha-test

2
star
46

django-1.11-python-3.7

Django 1.11 patched for Python 3.7 compatibility
Python
2
star
47

mooslider

JavaScript
2
star
48

aurbuilds

aurbuilds builds
Python
2
star
49

biscuit

Biscuit Is a Stupid ContinUous InTegration server (for GitHub)
Python
2
star
50

configfiles

/etc and so on.
Shell
1
star
51

mima-simulator

Clojure assembler and interpreter for an imaginary microprocessor used for teaching at my university.
Clojure
1
star
52

easyhtml

Indentation aware HTML. No more <, >, /
Haskell
1
star
53

celeryq.com

Tutorials, tips and tricks for the Celery task queue for Python || Celery Cloud Hosting
CSS
1
star
54

ml-misc

Random Machine Learning related code snippets, utils, recipes, etc
Python
1
star
55

jonas.lophus.org

My blog/website
CSS
1
star
56

svt

Simple Vocabulary Trainer
Python
1
star
57

dwm

dwm mirror + mod branch
C
1
star
58

micromamba-installer

Shell
1
star
59

git-com-aster

git com aster -> git co master
Shell
1
star
60

django-project-template

Skeleton for Django projects
Python
1
star
61

pandas-memorytools

Python
1
star
62

sqlar

C
1
star
63

thumblib

small Python thumbnailing library using PIL
Python
1
star
64

libcoverart

simple Python library for fetching cover art
Python
1
star
65

django-model-utils

Django model mixins and utilities.
Python
1
star