Improved default for php max children (#1738)

Fixes #1624
This commit is contained in:
Jürgen 2023-04-24 11:15:23 +02:00 committed by GitHub
parent 0f4de56086
commit 6750497924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -42,10 +42,13 @@ tmpl_php_max_filesize() {
} }
tmpl_php_threads() { tmpl_php_threads() {
local TOTAL_MEM="$( get_total_mem )"
local PHPTHREADS="$(find_app_param nc-limits PHPTHREADS)" local PHPTHREADS="$(find_app_param nc-limits PHPTHREADS)"
[[ $PHPTHREADS -eq 0 ]] && PHPTHREADS=$(nproc) # By default restricted by memory / 100MB
[[ $PHPTHREADS -lt 6 ]] && PHPTHREADS=6 [[ $PHPTHREADS -eq 0 ]] && PHPTHREADS=$(( TOTAL_MEM / ( 100 * 1024 * 1024 ) ))
echo -n "$PHPTHREADS" # Minimum 16
[[ $PHPTHREADS -lt 16 ]] && PHPTHREADS=16
echo -n "$PHPTHREADS"
} }
configure() configure()

View File

@ -2,7 +2,7 @@
"id": "nc-limits", "id": "nc-limits",
"name": "Nc-limits", "name": "Nc-limits",
"title": "nc-limits", "title": "nc-limits",
"description": "Configure system limits for NextCloudPi", "description": "Configure system limits for NextcloudPi",
"info": "Examples: 200M or 2G. Write 0 for autoconfig", "info": "Examples: 200M or 2G. Write 0 for autoconfig",
"infotitle": "", "infotitle": "",
"params": [ "params": [

View File

@ -9,7 +9,7 @@ if [[ "$1" == "--defaults" ]] || ! [[ -f "${BINDIR}/CONFIG/nc-limits.sh" ]]
then then
echo "INFO: Restoring template to default settings" >&2 echo "INFO: Restoring template to default settings" >&2
PHPTHREADS=6 PHPTHREADS=16
else else
PHPTHREADS="$(source "${BINDIR}/CONFIG/nc-limits.sh"; tmpl_php_threads)" PHPTHREADS="$(source "${BINDIR}/CONFIG/nc-limits.sh"; tmpl_php_threads)"
fi fi