-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(docker): Make Gunicorn max_requests and max_requests_jitter adjustable #20733
fix(docker): Make Gunicorn max_requests and max_requests_jitter adjustable #20733
Conversation
@zhaoyongjie please review and approve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, it's a useful workaround for memory leaks.
Seeing this in logs during docker compose (posting in case related):
|
getting default value should be ${parameter:-word} instead of ${parameter:word}. I will push the fix. |
sorry. my bad, i missed the hyphen. Thanks for reporting @z6cr0b3rts and thanks for the quick fix @zhaoyongjie. |
What's the timeline on the docker hub image? How long would it take to release a new image? The one published is broken now. @zhaoyongjie |
@evkuzin updated build is available now. |
We have tried this solution sometime back with custom docker image, but faced lot of intermittent http504s. |
@low-on-mana We have it enabled for a while now but I don’t see any 504's. For you, Is it 502 bad gateway or 504 gateway time out? |
504 gateway timeout @mdeshmu . |
@low-on-mana Please make sure you have appropriate jitter parameter value as it is needed to avoid simultaneous restarts of workers. Another possibility, Maybe your queries are occasionally taking longer time. Please make sure you are having large enough timeout values at all places. This is what i have, ALB idle timeout (120s) > I also have ecs task (gunicorn + superset) directly under alb and was intermittently getting 502 bad gateway because of low keep alive of gunicorn. Then i set it below and all errors were gone. GUNICORN_KEEPALIVE (125s) > |
@mdeshmu Thanks for sharing this, I will check these configuration out. |
Co-authored-by: Multazim Deshmukh <[email protected]> (cherry picked from commit 8832410)
Co-authored-by: Multazim Deshmukh <[email protected]> (cherry picked from commit 8832410)
SUMMARY
This PR allows to adjust Gunicorn max_requests and max_requests_jitter which allows to restart the Gunicorn worker process periodically.
This is a simple method to help limit the damage of memory leaks like one reported in 15132.
For more details, Please refer to: https://docs.gunicorn.org/en/stable/settings.html#max-requests
Default values are set to zero to match gunicorn's default i.e. automatic worker restarts are disabled by default.
Note: This change is non-disruptive, no end user will be impacted unless they turn on settings.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Set the values like:
gunicorn --max-requests 1024 --max-requests-jitter 100 ....
ADDITIONAL INFORMATION