So I built a python app in flask, and I want to do some load testing.
For that I want to run it over multiple ports. Currently when I do
flask run
it by default runs on port 5000, but I want it to also run on 5001 and 5002.
How do I do that?
So I built a python app in flask, and I want to do some load testing.
For that I want to run it over multiple ports. Currently when I do
flask run
it by default runs on port 5000, but I want it to also run on 5001 and 5002.
How do I do that?
You might want to consider running the service under Gunicorn
http://docs.gunicorn.org/en/stable/run.html
Gunicorn has a --workers
option which allows you to specify the number of instances of your service to run.
The nice thing about using Gunicorn is you don't need to worry about starting up/stopping multiple instances of your service by hand as it deals with it for you.
The other nice thing is you'll have a single interface to the multiple workers running under it.
This article explains how to add Gunicorn to a Flask project.