From 5c74f4595f23094e9f9100ace6a82cd644e925c2 Mon Sep 17 00:00:00 2001 From: Valentijn Scholten Date: Sat, 30 Aug 2025 18:16:02 +0200 Subject: [PATCH] uwsgi: default to 4 processes x 4 threads --- Dockerfile.django-alpine | 4 +- Dockerfile.django-debian | 4 +- docker/entrypoint-uwsgi-dev.sh | 4 +- docker/entrypoint-uwsgi.sh | 4 +- .../installation/running-in-production.md | 4 +- docs/content/en/open_source/performance.md | 39 ------------------- helm/defectdojo/templates/configmap.yaml | 4 +- 7 files changed, 12 insertions(+), 51 deletions(-) delete mode 100644 docs/content/en/open_source/performance.md diff --git a/Dockerfile.django-alpine b/Dockerfile.django-alpine index 939662de865..4a4079c48c7 100644 --- a/Dockerfile.django-alpine +++ b/Dockerfile.django-alpine @@ -132,8 +132,8 @@ ENV \ DD_INITIALIZE=true \ DD_UWSGI_MODE="socket" \ DD_UWSGI_ENDPOINT="0.0.0.0:3031" \ - DD_UWSGI_NUM_OF_PROCESSES="2" \ - DD_UWSGI_NUM_OF_THREADS="2" + DD_UWSGI_NUM_OF_PROCESSES="4" \ + DD_UWSGI_NUM_OF_THREADS="4" ENTRYPOINT ["/entrypoint-uwsgi.sh"] FROM django AS django-unittests diff --git a/Dockerfile.django-debian b/Dockerfile.django-debian index da5b4b3a22a..2a263e1bf48 100644 --- a/Dockerfile.django-debian +++ b/Dockerfile.django-debian @@ -135,8 +135,8 @@ ENV \ DD_INITIALIZE=true \ DD_UWSGI_MODE="socket" \ DD_UWSGI_ENDPOINT="0.0.0.0:3031" \ - DD_UWSGI_NUM_OF_PROCESSES="2" \ - DD_UWSGI_NUM_OF_THREADS="2" + DD_UWSGI_NUM_OF_PROCESSES="4" \ + DD_UWSGI_NUM_OF_THREADS="4" ENTRYPOINT ["/entrypoint-uwsgi.sh"] FROM django AS django-unittests diff --git a/docker/entrypoint-uwsgi-dev.sh b/docker/entrypoint-uwsgi-dev.sh index 200e3ec2107..45b6204f5a9 100755 --- a/docker/entrypoint-uwsgi-dev.sh +++ b/docker/entrypoint-uwsgi-dev.sh @@ -34,8 +34,8 @@ exec uwsgi \ --protocol uwsgi \ --wsgi dojo.wsgi:application \ --enable-threads \ - --processes "${DD_UWSGI_NUM_OF_PROCESSES:-2}" \ - --threads "${DD_UWSGI_NUM_OF_THREADS:-2}" \ + --processes "${DD_UWSGI_NUM_OF_PROCESSES:-4}" \ + --threads "${DD_UWSGI_NUM_OF_THREADS:-4}" \ --reload-mercy 1 \ --worker-reload-mercy 1 \ --py-autoreload 1 \ diff --git a/docker/entrypoint-uwsgi.sh b/docker/entrypoint-uwsgi.sh index a355ceeb7ee..f15f2b49958 100755 --- a/docker/entrypoint-uwsgi.sh +++ b/docker/entrypoint-uwsgi.sh @@ -36,8 +36,8 @@ exec uwsgi \ "--${DD_UWSGI_MODE}" "${DD_UWSGI_ENDPOINT}" \ --protocol uwsgi \ --enable-threads \ - --processes "${DD_UWSGI_NUM_OF_PROCESSES:-2}" \ - --threads "${DD_UWSGI_NUM_OF_THREADS:-2}" \ + --processes "${DD_UWSGI_NUM_OF_PROCESSES:-4}" \ + --threads "${DD_UWSGI_NUM_OF_THREADS:-4}" \ --wsgi dojo.wsgi:application \ --buffer-size="${DD_UWSGI_BUFFER_SIZE:-8192}" \ --http 0.0.0.0:8081 --http-to "${DD_UWSGI_ENDPOINT}" \ diff --git a/docs/content/en/open_source/installation/running-in-production.md b/docs/content/en/open_source/installation/running-in-production.md index bee0830b204..e060d1e212c 100644 --- a/docs/content/en/open_source/installation/running-in-production.md +++ b/docs/content/en/open_source/installation/running-in-production.md @@ -58,9 +58,9 @@ handle 4 concurrent connections. Based on your resource settings, you can tweak: - `DD_UWSGI_NUM_OF_PROCESSES` for the number of spawned processes. - (default 2) + (default 4) - `DD_UWSGI_NUM_OF_THREADS` for the number of threads in these - processes. (default 2) + processes. (default 4) For example, you may have 4 processes with 6 threads each, yielding 24 concurrent connections. diff --git a/docs/content/en/open_source/performance.md b/docs/content/en/open_source/performance.md deleted file mode 100644 index 4504e4a3158..00000000000 --- a/docs/content/en/open_source/performance.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Performance Enhancements (Open Source)" -description: "Settings to configure to enhance performance in DefectDojo" -draft: false -weight: 4 ---- - -## Filter String Matching Optimization - -IN the UI, many of the filters for a given object will also query related objects -for an easy visual match of an item to filter on. For instances with many objects, -this could lead to a considerable performance hit. To alleviate this constriction, -enable the "Filter String Matching Optimization" setting in the System Settings to -change many filters to only search on names, rather than the objects themselves. -This change will save many large queries, and will improve the performance of UI -based interactions. - -## Asynchronous Delete - -For larger instances, deleting an object can take minutes for all related objects to be -expanded into memory, rendered on the page, and then removing all objects from the database. -To combat this issue, two settings can be set in `local_settings.py`: - -#### ASYNC_OBJECT_DELETE - -Deleting an object asynchronously changes the way an object is deleted under the hood. By removing -the need to expand into memory, a lot of time (and memory) can be saved by offloading the lookups and -removals onto celery processes. This process works by starting at the bottom of a given object, and -walking the tree upwards rather than downwards. This way, objects can be seperated into buckets, -and then deleted. - -#### DELETE_PREVIEW - -Previewing all the objects to be deleted takes almost as much time as deleting the objects itself. -This is a safety feature intended to warn users of what they are about to delete, as well as educating -users of how the delete functionality works by cascade deleting all related objects. With this feature enabled, -the user will only see the following text in the delete preview (without any database lookups) - -`Previewing the relationships has been disabled.` diff --git a/helm/defectdojo/templates/configmap.yaml b/helm/defectdojo/templates/configmap.yaml index 74d516981c7..a5f3706526e 100644 --- a/helm/defectdojo/templates/configmap.yaml +++ b/helm/defectdojo/templates/configmap.yaml @@ -45,8 +45,8 @@ data: DD_UWSGI_ENDPOINT: /run/defectdojo/uwsgi.sock DD_UWSGI_HOST: localhost DD_UWSGI_PASS: unix:///run/defectdojo/uwsgi.sock - DD_UWSGI_NUM_OF_PROCESSES: '{{ .Values.django.uwsgi.appSettings.processes | default 2 }}' - DD_UWSGI_NUM_OF_THREADS: '{{ .Values.django.uwsgi.appSettings.threads | default 2 }}' + DD_UWSGI_NUM_OF_PROCESSES: '{{ .Values.django.uwsgi.appSettings.processes | default 4 }}' + DD_UWSGI_NUM_OF_THREADS: '{{ .Values.django.uwsgi.appSettings.threads | default 4 }}' DD_UWSGI_MAX_FD: '{{ .Values.django.uwsgi.appSettings.maxFd }}' DD_DJANGO_METRICS_ENABLED: '{{ .Values.monitoring.enabled }}' NGINX_METRICS_ENABLED: '{{ .Values.monitoring.enabled }}'