Closed alexellis closed 5 years ago
I was doing some testing of this template, using gevent, flask dev server, gunicorn, and gunicorn with gevent. I was just doing a basic page template. What I found is that flask dev server and gevent are both approximately the same speed. The two servers with gunicorn were about double the speed of the flask dev server. Of course results will vary based on what you are doing. A function with external api calls will do much better with gevent workers.
I would suggest that openfaas switch to gunicorn as the default server and make a template both for gunicorn and gunicorn with gevent workers so that users can choose based on their workload. If you want, I could submit a pull request that converts the default template to gunicorn and adds a template that uses gunicorn with gevent.
Side note, I believe that this gets rid of the need for the workaround. Also, if people use the gunicorn version, the build time will be faster, but gunicorn with gevent will have the same slow build time.
Flask dev server is easier to use, but as mentioned in the docs it states that is it not production ready because it doesn't scale well. Could this scaling be resolved by the openfaas auto-scaling functionality?
I would advise against that. Flask Dev server under load can easily have high latency or even crash. The production alternatives are much more robust. I would use a production server under openfaas rather than the Dev server. Dev stuff in prod is always a bad idea.
Werkzeug seems to take a significant amount of time to build and needs work-arounds for chunked-encoding #5 #10
How good is the Flask dev server? Should we do some testing or pre-compile Werkzeug in a base image?