简体   繁体   中英

Can Flask run on Gunicorn alone?

I'm currently developing HTTP Rest API server using Flask and Gunicorn. For various reason, it is not possible to put a reverse proxy server in front of Gunicorn. I don't have any static media, and all url are being served by @app.route pattern in Flask Framework. Can Flask run on Gunicorn alone?

It could, but it is a very bad idea. Gunicorn is not working well without a proxy that is doing request and response buffering for slow clients.

Without buffering the gunicorn worker has to wait until the client has send the whole request and then has to wait until the client has read the whole response.

This can be a serious problem if there are clients on a slow network for example.

http://docs.gunicorn.org/en/latest/deploy.html?highlight=buffering

see also: http://blog.etianen.com/blog/2014/01/19/gunicorn-heroku-django/

Because Gunicorn has a relatively small (2x CPU cores) pool of workers, if can only handle a small number of concurrent requests. If all the worker processes become tied up waiting for network traffic, the entire server will become unresponsive. To the outside world, your web application will cease to exist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM