Skip to content
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

NOREF Limit requests handled by workers #1901

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

mwbenowitz
Copy link
Collaborator

This update introduces two configuration settings for our gunicorn server:

  • max_requests Limits the number of total requests that can be handled by a single gunicorn worker. The gunicorn docs state this is intended to help limit effects of memory leaks
  • max_requests_jitter This randomizes the exact number of requests to prevent multiple workers from being restarted simultaneously

The goal of this work is to hopefully limit memory consumption (which tends to run at 90% or greater in production) and to reduce the effect of QueuePool errors that result from long-running workers. At the current setting of 500 this should result in workers being restarted roughly every 45-60 minutes. This can be adjusted after review of effects on performance in QA (and production if no issues are raised in QA).

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

This update introduces two configuration settings for our gunicorn server:

- `max_requests` Limits the number of total requests that can be handled by a single gunicorn worker. The gunicorn docs state this is intended to help limit effects of memory leaks
- `max_requests_jitter` This randomizes the exact number of requests to prevent multiple workers from being restarted simultaneously

The goal of this work is to hopefully limit memory consumption (which tends to run at 90% or greater in production) and to reduce the effect of `QueuePool` errors that result from long-running workers. At the current setting of 500 this should result in workers being restarted roughly every 45-60 minutes. This can be adjusted after review of effects on performance in QA (and production if no issues are raised in QA).
These values (500 and 50) should give us the desired performance in production.
@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (9b92207) 92.56% compared to head (32605c5) 92.56%.
Report is 15 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1901   +/-   ##
========================================
  Coverage    92.56%   92.56%           
========================================
  Files          216      216           
  Lines        43647    43648    +1     
========================================
+ Hits         40400    40401    +1     
  Misses        3247     3247           
Files Changed Coverage Δ
core/scripts.py 86.48% <ø> (ø)
api/authenticator.py 96.52% <100.00%> (+<0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mwbenowitz mwbenowitz merged commit 153abf5 into develop Aug 11, 2023
4 checks passed
@mwbenowitz mwbenowitz deleted the NOREF-limit-gunicorn-workers branch August 11, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant