Skip to content

Commit

Permalink
Use nproc to detect available cpus
Browse files Browse the repository at this point in the history
  • Loading branch information
nemchik authored May 14, 2021
1 parent 49bd204 commit 2ea807d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion root/etc/cont-init.d/50-config
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fi

# Set worker_processes
if ! grep -q 'worker_processes' /config/nginx/worker_processes.conf; then
WORKER_PROCESSES=$(wc -w < /sys/fs/cgroup/cpuacct/cpuacct.usage_percpu)
WORKER_PROCESSES=$(nproc)
echo "Setting worker_processes to ${WORKER_PROCESSES}"
echo "# This file is auto-generated only on first start, based on the cpu cores detected. Feel free to change it to any other number or to auto to let nginx handle it automatically.\nworker_processes ${WORKER_PROCESSES};" > /config/nginx/worker_processes.conf
fi
Expand Down

0 comments on commit 2ea807d

Please sign in to comment.