From 15f113f018db446e59521657c536e5997a8493ce Mon Sep 17 00:00:00 2001 From: Sebastian Drozd <163430081+tzezar@users.noreply.github.com> Date: Fri, 13 Jun 2025 11:18:58 +0200 Subject: [PATCH 1/4] feat(): add custom worker count support --- 5.1/start.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/5.1/start.sh b/5.1/start.sh index 0634939..301f79c 100755 --- a/5.1/start.sh +++ b/5.1/start.sh @@ -80,13 +80,20 @@ export NOMINATIM_QUERY_TIMEOUT=10 export NOMINATIM_REQUEST_TIMEOUT=60 echo "Warming finished" +# Set default number of workers if not specified +if [ -z "$GUNICORN_WORKERS" ]; then + GUNICORN_WORKERS=4 +fi + +echo "Starting Gunicorn with $GUNICORN_WORKERS workers" + echo "--> Nominatim is ready to accept requests" cd "$PROJECT_DIR" sudo -u nominatim gunicorn \ --bind :8080 \ --pid $GUNICORN_PID_FILE \ - --workers 4 \ + --workers $GUNICORN_WORKERS \ --daemon \ --enable-stdio-inheritance \ --worker-class uvicorn.workers.UvicornWorker \ From d63e8c57c20f18dc16a862f10da9f60c410118bf Mon Sep 17 00:00:00 2001 From: Sebastian Drozd <163430081+tzezar@users.noreply.github.com> Date: Fri, 13 Jun 2025 11:19:09 +0200 Subject: [PATCH 2/4] docs(): --- 5.1/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/5.1/README.md b/5.1/README.md index eb96013..ca46db6 100644 --- a/5.1/README.md +++ b/5.1/README.md @@ -62,6 +62,7 @@ Other places at Geofabrik follow the pattern `https://download.geofabrik.de/$CON - `IMPORT_GB_POSTCODES`: Whether to download and import the GB postcode dump (`true`) or path to GB postcode dump in the container. (default: `false`) - `IMPORT_TIGER_ADDRESSES`: Whether to download and import the Tiger address data (`true`) or path to a preprocessed Tiger address set in the container. (default: `false`) - `THREADS`: How many threads should be used to import (default: number of processing units available to the current process via `nproc`) +- `GUNICORN_WORKERS`: How many Gunicorn worker processes should handle API requests (default: 4). Increase this value for higher concurrent request handling capacity. - `NOMINATIM_PASSWORD`: The password to connect to the database with (default: `qaIACxO6wMR3`) The following run parameters are available for configuration: From 0874633c2804ece4fdd5e76eb6263122ec647f4e Mon Sep 17 00:00:00 2001 From: Sebastian Drozd <163430081+tzezar@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:32:47 +0200 Subject: [PATCH 3/4] feat(): use nproc instead --- 5.1/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.1/start.sh b/5.1/start.sh index 301f79c..7fbbec0 100755 --- a/5.1/start.sh +++ b/5.1/start.sh @@ -82,7 +82,7 @@ echo "Warming finished" # Set default number of workers if not specified if [ -z "$GUNICORN_WORKERS" ]; then - GUNICORN_WORKERS=4 + GUNICORN_WORKERS=$(nproc) fi echo "Starting Gunicorn with $GUNICORN_WORKERS workers" From 6f6cdac28af5d758ce7f10db5f0ba002a5d7e403 Mon Sep 17 00:00:00 2001 From: Sebastian Drozd <163430081+tzezar@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:32:51 +0200 Subject: [PATCH 4/4] docs(): --- 5.1/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.1/README.md b/5.1/README.md index ca46db6..6c0c0ad 100644 --- a/5.1/README.md +++ b/5.1/README.md @@ -62,7 +62,7 @@ Other places at Geofabrik follow the pattern `https://download.geofabrik.de/$CON - `IMPORT_GB_POSTCODES`: Whether to download and import the GB postcode dump (`true`) or path to GB postcode dump in the container. (default: `false`) - `IMPORT_TIGER_ADDRESSES`: Whether to download and import the Tiger address data (`true`) or path to a preprocessed Tiger address set in the container. (default: `false`) - `THREADS`: How many threads should be used to import (default: number of processing units available to the current process via `nproc`) -- `GUNICORN_WORKERS`: How many Gunicorn worker processes should handle API requests (default: 4). Increase this value for higher concurrent request handling capacity. +- `GUNICORN_WORKERS`: Specifies how many Gunicorn worker processes should handle API requests. If not explicitly set, it defaults to the number of available CPU cores `(nproc)`. Increase this value to improve concurrent request handling capacity, but ensure it aligns with your server's CPU resources. - `NOMINATIM_PASSWORD`: The password to connect to the database with (default: `qaIACxO6wMR3`) The following run parameters are available for configuration: