I've got a Flask based web application that deploys to AWS Lambda via Zappa. All is well and good.
The Flask documentation says:
While lightweight and easy to use, Flask’s built-in server is not suitable for production as it doesn’t scale well. Some of the options available for properly running Flask in production are documented here.
On a stand-alone server, Python is single threaded (Global Interpreter Lock (GIL) etc) and therefore doesn't handle multiple requests well without due care and attention.
On AWS Lambda (and presumably other FaaS infrastructure) each HTTP requests gets a separate Python instance, so the GIL is not an issue and Lambda takes care of scaling by using multiple function invocations.
Therefore, is using a WGSI container (Gunicorn, uWGSI, etc) so strongly recommended when running on AWS Lambda? Why or why not?
Some factors I can guess might be relevant include:
- cost
- resources (e.g. database connections)
- bugs
- start up performance
- per request overhead