uWSGI with NetBox #14780
Replies: 10 comments 16 replies
-
I have now run a couple of NetBox 3.7.x instances with these uWSGI+systemd configurations a few days successfully, looks good. Obviously Note that I didn't add any I'll still keep updating the configs above if I find something to adjust. Feel free to tell your own experiences about using uWSGI with NetBox. |
Beta Was this translation helpful? Give feedback.
-
Hint, when the statistics are enabled in the config above:
--> lets you monitor the worker processes in real-time (use |
Beta Was this translation helpful? Give feedback.
-
Number of requests served by all the workers (processes = 5, threads = 3 in this setup):
Memory usage of all uWSGI processes combined for seven days (this NetBox 3.7.1 instance was started just about exactly 7 days ago), after those ~350k requests: |
Beta Was this translation helpful? Give feedback.
-
Those who are willing/needing to capture the uwsgi protocol traffic (like |
Beta Was this translation helpful? Give feedback.
-
Here's my uwsgi config, I'm using this Ansible role to manage it: https://github.com/lae/ansible-role-netbox [uwsgi]
master=true
protocol=uwsgi
uid=netbox
gid=netbox
processes=8
module=netbox.wsgi
virtualenv=/srv/netbox/current/venv-py3
chdir=/srv/netbox/current/netbox
static-map=/static=/srv/netbox/current/netbox/static
logger=file:logfile=/srv/netbox/shared/application.log,maxsize=50000000
req-logger=file:logfile=/srv/netbox/shared/requests.log,maxsize=50000000
env=prometheus_multiproc_dir=/run/netbox_metrics
; Ensures the app successfully loads, otherwise uwsgi will stay running with no active app to serve
need-app=True
; Only run if all uwsgi parameters are valid uwsgi parameters
strict=True
; If you have large query parameters or domain cookies increase this above the default
buffer-size=4096
harakiri=60
max-requests=5000
max-worker-lifetime=43200
max-worker-lifetime-delta=60
worker-reload-mercy=60
single-interpreter=True
log-date=[%%Y-%%m-%%d %%H:%%M:%%S] |
Beta Was this translation helpful? Give feedback.
-
uWSGI process memory usage after running NetBox for two weeks and ~750k requests: |
Beta Was this translation helpful? Give feedback.
-
FYI there is some current uWSGI+Sentry issue (I see NetBox has some Sentry integration available, don't know about that): |
Beta Was this translation helpful? Give feedback.
-
One more memory graph for this NetBox 3.7.1 for seven days: Before system reboot uWSGI memory usage was above 2.7 GB, after reboot and ~170k requests in three days it is currently about 2.63 GB. |
Beta Was this translation helpful? Give feedback.
-
About installing uWSGI with |
Beta Was this translation helpful? Give feedback.
-
Adding this piece of information. These don't work with
With
With
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
uWSGI is new for me, but thinking about replacing gunicorn with it. Any comments for my attempt to replicate the stock gunicorn setup as uWSGI?
/opt/netbox/venv/bin/pip install uwsgi
(and add
uwsgi
in local_requirements.txt)/opt/netbox/netbox/local/uwsgi.ini:
/etc/systemd/system/netbox.service:
/etc/nginx/sites-enabled/netbox (I only have port 80 as I'm behind AWS ALB that does TLS offloading):
With this setup it seems to work:
sudo systemctl reload netbox
causes a graceful reload of uWSGIbuffer-size
valueQuestions in mind:
Anything else?
Tagging @tyler-8 here as he happened to mention using uWSGI 🙂
Beta Was this translation helpful? Give feedback.
All reactions