Why is auto-reload on code change only for debugging with Gunicorn?

Deadly 提交于 2019-12-24 02:58:30

问题


I'm using Gunicorn to run my Flask website in production. It all works fine, but when deploying updates I always stop and start the server again. I now read about this reload flag which "restarts workers when code changes" which according to the docs is "intended for development". If I could use this in production it would prevent the need to stop & restart gunicorn when deploying.

What is the reason that I should not use auto-reload in production?


回答1:


The reload flag can be used in production and basically it does the same thing you do manually when restarting gunicorn.

The basic reason not to use auto-restart in production is that you are compromising the reliability of the service to third parties, without any possibility of control from your part.

Imagine that your service is continuously updated with new code. Some of it might be buggy and break the user experience and you would have no way of preventing that. On the other hand, if you update the app multiple times during a day, your users would be potentially losing data/having a bad experience multiple times during the day.



来源:https://stackoverflow.com/questions/36975143/why-is-auto-reload-on-code-change-only-for-debugging-with-gunicorn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!