问题
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