Gunicorn --preload option is causing workers to hang?

北城余情 提交于 2021-02-09 08:23:27

问题


We have a flask app that uses a lot of memory for ML models, and I'm trying to reduce the memory footprint by using gunicorn's preload option, but when I add the --preload flag, and deploy that (with -w 4, to a docker container running on GKE), it will handle just a few requests, and then hang until it times out, at which point gunicorn will start another worker to replace it and the same thing will happen. It's not clear yet how many requests each worker will process before hanging (possibly just 1... possibly a few)

The timeout is over 10 minutes, so it seems to be hanging indefinitely.

This does not happen at all if I remove the --preload flag.

What is it about the --preload flag that could be causing the workers to hang indefinitely?

来源:https://stackoverflow.com/questions/58757003/gunicorn-preload-option-is-causing-workers-to-hang

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