This is the code to accompany an article.
Assuming you have at least Python 3.6, firstly to setup:
$ python -m venv venv $ source venv/bin/activate $ pip install -r app/requirements.txt $ cd app && gunicorn --config gunicorn.py 'run:create_app()'
The commands used to measure the performance of the apps are,
$ wrk --connections 20 --duration 5m http://localhost:5000/films/ $ wrk --connections 20 --duration 5m http://localhost:5000/films/995/ $ wrk --connections 20 --duration 5m --script post.lua http://localhost:5000/reviews/
All of the above assumes you have the Postgres sample database running locally with the following addition made,
CREATE TABLE review (
film_id INTEGER REFERENCES film(film_id),
rating INTEGER
);
and a dvdrental user/role to access the database.