What is the fastest web framework for Python? In this post we will examine a trivial 'Hello World!'. See also:
- Performance Benchmarks
- Code Quality
- Template Engines
The application (see
source) is written for various Python web frameworks and deployed to
uWSGI application container (version 1.9.6 on CPython 2.7.4/3.3.1) and
gunicorn (version 0.15.0 on PyPy 1.9). Latest available versions as of this writing (March 15, 2013):
- bobo 1.0.0
- bottle 0.11.6
- cherrypy 3.2.4
- circuits 2.1.0
- django 1.5.1
- flask 0.9
- pyramid 1.4
- tornado 3.0.1
- turbogears 2.2.0
- web.py 0.37
- web2py 2.1.1
- wheezy.web 0.1.365
Let setup few prerequisites to be able run this in clean debian testing installation.
apt-get install make python-dev python-virtualenv \
mercurial unzip
# Up TCP connection limits
sysctl net.core.somaxconn=2048
sysctl net.ipv4.tcp_max_syn_backlog=2048
The
source code is hosted on bitbucket, let clone it into some directory and setup virtual environment (this will download all necessary package dependencies per framework listed above).
hg clone https://bitbucket.org/akorn/helloworld
cd helloworld/01-welcome && make env
The make file has a target for each framework and runs particular example in uWSGI, e.g. in order to run django application just issue
make django.