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