diff --git a/start.sh b/start.sh index e7129ffb..55bc9c45 100755 --- a/start.sh +++ b/start.sh @@ -147,14 +147,9 @@ else # Only set if `WEB_CONCURRENCY` is not defined, allows overriding. # See: https://docs.gunicorn.org/en/latest/settings.html#workers if [ -z "$WEB_CONCURRENCY" ]; then - # Default gunicorn worker count to 2 x availabe cores + 1 - # nproc gives _available_ (rather than physicall present) CPU cores. - CPU_COUNT=$(nproc) - export WEB_CONCURRENCY=$((2*$CPU_COUNT+1)) - echo "Setting WEB_CONCURRENCY based on $CPU_COUNT available CPU cores to start $WEB_CONCURRENCY gunicorn workers." - else - echo "Using pre-defined WEB_CONCURRENCY override to start $WEB_CONCURRENCY gunicorn workers." + export WEB_CONCURRENCY=$((2*$(nproc)+1)) fi + echo "Web concurrency set to $WEB_CONCURRENCY" congrats diff --git a/worker.sh b/worker.sh index 6f02b9c2..51c60017 100755 --- a/worker.sh +++ b/worker.sh @@ -46,17 +46,11 @@ environment_check(){ export WO_BROKER=redis://localhost fi - # Only set if `WEB_CONCURRENCY` is not defined, allows overriding. - # See: https://docs.gunicorn.org/en/latest/settings.html#workers - if [ -z "$WEB_CONCURRENCY" ]; then - # Default gunicorn worker count to 2 x availabe cores + 1 - # nproc gives _available_ (rather than physicall present) CPU cores. - CPU_COUNT=$(nproc) - export WEB_CONCURRENCY=$((2*$CPU_COUNT+1)) - echo "Setting WEB_CONCURRENCY based on $CPU_COUNT available CPU cores to start $WEB_CONCURRENCY gunicorn workers." - else - echo "Using pre-defined WEB_CONCURRENCY override to start $WEB_CONCURRENCY gunicorn workers." - fi + # Only set if `WEB_CONCURRENCY` is not defined, allows overriding. + # See: https://docs.gunicorn.org/en/latest/settings.html#workers + if [ -z "$WEB_CONCURRENCY" ]; then + export WEB_CONCURRENCY=$((2*$(nproc)+1)) + fi }