Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.
/ python-loadtests Public archive

Performance benchmarks and setup-complexity comparison for Sanic, Flask, Connexion and Django

License

Notifications You must be signed in to change notification settings

c-w/python-loadtests

Repository files navigation

Python loadtests

This repository contains sample apps and server setup scripts for a variety of Python web stacks:

  • Sanic with Authbind
  • Flask (behind gUnicorn and Nginx)
  • Django (behind Apache)
  • Connexion (behind Tornado and Nginx)

There is also a companion talk for this repository that I gave at the Code & Coffee Meetup in Vancouver.

For each of these stacks, we then run a load-test that consists of a network-bound task and a framework-bound task.

Authbind + Sanic is the easiest stack to set up and is competitive performance-wise with more complicated stacks.

Benchmarks of Sanic versus Flask, Connexion and Django

To reproduce these results, first set up a server for each of the web stacks using the setup scripts:

stack_type=sanic_authbind  # or connexion_tornado_nginx or django_modwsgi_apache or flask_gunicorn_nginx
curl -O https://raw.githubusercontent.com/c-w/python-loadtests/master/${stack_type}/setup.sh | bash -s my-azure-storage-account my-azure-storage-key

Now on a seperate driver machine, set up the data store for the network-bound task and then run the load test:

curl -O https://raw.githubusercontent.com/c-w/python-loadtests/master/shared/setup.sh | bash
py_env/bin/python3 setup_azure_tables.py --account=my-azure-storage-account --key=my-azure-storage-key

test_type=SanicTest  # or ConnexionTest or DjangoTest or FlaskTest
py_env/bin/locust ${test_type} --only-summary --no-web --clients=500 --hatch-rate=50  # let run for a while, then hit ctrl+c to see results

About

Performance benchmarks and setup-complexity comparison for Sanic, Flask, Connexion and Django

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published