Adjust nginx proc count based on available CPUs (#11653)

* Restrict nginx to 4 processes if more are available

* Fix bash

* Different sed structure

* Limit ffmpeg thread counts for secondary ffmpeg processes

* Add up / down keyboard shortcut
This commit is contained in:
Nicolas Mowen
2024-05-30 11:34:01 -06:00
committed by GitHub
parent 402c16e7df
commit 142641b387
5 changed files with 37 additions and 2 deletions

View File

@@ -8,6 +8,19 @@ set -o errexit -o nounset -o pipefail
echo "[INFO] Starting NGINX..."
function set_worker_processes() {
# Capture number of assigned CPUs to calculate worker processes
local proc_count
if proc_count=$(nproc --all) && [[ $proc_count -gt 4 ]]; then
proc_count=4;
fi
sed -i "s/worker_processes auto;/worker_processes ${proc_count};/" /usr/local/nginx/conf/nginx.conf
}
set_worker_processes
# Replace the bash process with the NGINX process, redirecting stderr to stdout
exec 2>&1
exec nginx