Add max_requests parameters to Gunicorn example config #2990

Closed
opened 2025-12-29 18:24:28 +01:00 by adam · 1 comment
Owner

Originally created by @tyler-8 on GitHub (Oct 31, 2019).

Change Type

[X] Addition
[ ] Correction
[ ] Deprecation
[ ] Cleanup (formatting, typos, etc.)

Proposed Changes

Related issue: https://github.com/netbox-community/netbox/issues/3598

As a general best practice with gunicorn webapps, it's a good idea to recycle the worker processes. This is done by using max_requests in the gunicorn config. It should be paired with max_requests_jitter to prevent all the gunicorn workers from being restarted at nearly the same time.

I'd like to add these parameters to this section of the docs:
https://github.com/netbox-community/netbox/blob/develop/docs/installation/3-http-daemon.md#gunicorn-installation

command = '/usr/bin/gunicorn'
pythonpath = '/opt/netbox/netbox'
bind = '127.0.0.1:8001'
workers = 3
user = 'www-data'
max_requests = 1000
max_requests_jitter = 200
Originally created by @tyler-8 on GitHub (Oct 31, 2019). <!-- Please indicate the nature of the change by placing an X in one of the boxes below. --> ### Change Type [X] Addition [ ] Correction [ ] Deprecation [ ] Cleanup (formatting, typos, etc.) <!-- Describe the proposed change(s). --> ### Proposed Changes Related issue: https://github.com/netbox-community/netbox/issues/3598 As a general best practice with `gunicorn` webapps, it's a good idea to recycle the worker processes. This is done by using `max_requests` in the `gunicorn` config. It should be paired with `max_requests_jitter` to prevent all the gunicorn workers from being restarted at nearly the same time. I'd like to add these parameters to this section of the docs: https://github.com/netbox-community/netbox/blob/develop/docs/installation/3-http-daemon.md#gunicorn-installation ```no-highlight command = '/usr/bin/gunicorn' pythonpath = '/opt/netbox/netbox' bind = '127.0.0.1:8001' workers = 3 user = 'www-data' max_requests = 1000 max_requests_jitter = 200 ```
adam added the status: acceptedtype: documentation labels 2025-12-29 18:24:28 +01:00
adam closed this issue 2025-12-29 18:24:28 +01:00
Author
Owner

@kobayashi commented on GitHub (Nov 1, 2019):

This is good idea!
How about add the link to gunicorn docs also?

@kobayashi commented on GitHub (Nov 1, 2019): This is good idea! How about add the link to [gunicorn docs](https://docs.gunicorn.org/en/stable/settings.html#max-requests) also?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2990