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() {
local TOTAL_MEM="$( get_total_mem )"
local PHPTHREADS="$(find_app_param nc-limits PHPTHREADS)"
[[ $PHPTHREADS -eq 0 ]] && PHPTHREADS=$(nproc)
[[ $PHPTHREADS -lt 6 ]] && PHPTHREADS=6
echo -n "$PHPTHREADS"
# By default restricted by memory / 100MB
[[ $PHPTHREADS -eq 0 ]] && PHPTHREADS=$(( TOTAL_MEM / ( 100 * 1024 * 1024 ) ))
# Minimum 16
[[ $PHPTHREADS -lt 16 ]] && PHPTHREADS=16
echo -n "$PHPTHREADS"
}
configure()

View File

@ -2,7 +2,7 @@
"id": "nc-limits",
"name": "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",
"infotitle": "",
"params": [

View File

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