From 52a80e49da1632c83f3b06ce94d0327500356ba2 Mon Sep 17 00:00:00 2001 From: mjanez <96422458+mjanez@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:11:04 +0200 Subject: [PATCH] Fix uWSGI configuration to handle write errors and optimize performance --- ckan/setup/start_ckan.sh.override | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ckan/setup/start_ckan.sh.override b/ckan/setup/start_ckan.sh.override index ec3e3ace..68f01b49 100644 --- a/ckan/setup/start_ckan.sh.override +++ b/ckan/setup/start_ckan.sh.override @@ -57,8 +57,11 @@ chown -R ckan:ckan $CKAN_LOGS_PATH/xloader # Set the common uwsgi options. ## Add thunder-lock to prevent multiple workers from running the same job and buffer-size to prevent large headers ## To increase performance, you can adjust the number of processes (-p) (More info: https://uwsgi-docs.readthedocs.io/en/latest/Options.html & https://www.bloomberg.com/company/stories/configuring-uwsgi-production-deployment/) +# Fix uWSGI raises OSError: write error: https://stackoverflow.com/a/45393743 UWSGI_OPTS="--thunder-lock \ --ignore-sigpipe \ + --ignore-write-errors \ + --disable-write-exception \ --socket /tmp/uwsgi.sock \ --wsgi-file /srv/app/wsgi.py \ --module wsgi:application \ @@ -71,8 +74,8 @@ UWSGI_OPTS="--thunder-lock \ --harakiri $UWSGI_HARAKIRI \ --max-requests 500 \ --max-worker-lifetime 3600 \ - --reload-on-rss 1024 \ - --processes 2 \ + --reload-on-rss 2048 \ + --processes 4 \ --buffer-size 32768 \ --disable-logging \ --log-4xx \