tune PHP and FPM for 1-core/3GB VPS performance

Reduce FPM workers from 12 to 5 max to stop memory thrashing on
a single-core VPS with 3GB RAM. Add OPcache and APCu tuning to
reduce filesystem stat calls and improve cache hit rates.
This commit is contained in:
2026-03-22 17:31:14 +01:00
parent 0a305a47b9
commit 22198784d3
3 changed files with 15 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ services:
- ./hooks/post-installation.sh:/docker-entrypoint-hooks.d/post-installation/post-installation.sh:ro - ./hooks/post-installation.sh:/docker-entrypoint-hooks.d/post-installation/post-installation.sh:ro
- ./hooks/post-upgrade.sh:/docker-entrypoint-hooks.d/post-upgrade/post-upgrade.sh:ro - ./hooks/post-upgrade.sh:/docker-entrypoint-hooks.d/post-upgrade/post-upgrade.sh:ro
- ./fpm-tuning.conf:/usr/local/etc/php-fpm.d/zz-tuning.conf:ro - ./fpm-tuning.conf:/usr/local/etc/php-fpm.d/zz-tuning.conf:ro
- ./php-tuning.ini:/usr/local/etc/php/conf.d/zz-tuning.ini:ro
networks: networks:
- nextcloud-internal - nextcloud-internal
logging: logging:

View File

@@ -1,7 +1,7 @@
[www] [www]
pm = dynamic pm = dynamic
pm.max_children = 12 pm.max_children = 5
pm.start_servers = 4 pm.start_servers = 2
pm.min_spare_servers = 2 pm.min_spare_servers = 1
pm.max_spare_servers = 6 pm.max_spare_servers = 3
pm.max_requests = 500 pm.max_requests = 500

10
nextcloud/php-tuning.ini Normal file
View File

@@ -0,0 +1,10 @@
; OPcache tuning for Nextcloud
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.save_comments=1
opcache.enable_file_override=1
; APCu local cache
apc.shm_size=64M
apc.enable_cli=1