chore(server): allow configuring common opcache and fpm optimizations

This commit is contained in:
transcaffeine 2021-10-17 21:03:17 +02:00
parent 80317cae6a
commit 5bc19d4ddc
Signed by untrusted user: transcaffeine
GPG Key ID: 03624C433676E465
3 changed files with 28 additions and 12 deletions

View File

@ -58,3 +58,19 @@ nextcloud_paths:
mode: "0770" mode: "0770"
owner: "{{ nextcloud_user_info.uid|default(nextcloud_user) }}" owner: "{{ nextcloud_user_info.uid|default(nextcloud_user) }}"
group: "root" group: "root"
# PHP OpCache tuning
nextcloud_opcache_enable: 1
nextcloud_opcache_interned_strings_buffer_mb: 32
nextcloud_opcache_max_accelerated_files: 32531
nextcloud_opcache_memory_consumption_mb: 256
nextcloud_opcache_fast_shutdown: 1
nextcloud_opcache_save_comments: 1
nextcloud_opcache_revalidate_freq: 1
nextcloud_opcache_validate_timestamps: 0
# FPM config
nextcloud_fpm_max_children: 64
nextcloud_fpm_start_servers: "{{ nextcloud_fpm_max_children / 2 | int }}"
nextcloud_fpm_min_spare_servers: "{{ nextcloud_fpm_max_children / 4 | int }}"
nextcloud_fpm_max_spare_servers: "{{ nextcloud_fpm_max_children * 3/4 | int }}"

View File

@ -1,14 +1,14 @@
opcache.enable=1 opcache.enable={{ nextcloud_opcache_enable }}
opcache.interned_strings_buffer=32 opcache.interned_strings_buffer={{ nextcloud_opcache_interned_strings_buffer_mb }}
; next prime in the set which is suitable for large installations ; next prime in the set which is suitable for large installations
; default for this setting is 10000 which picks the prime 7963, ; default for this setting is 10000 which picks the prime 7963,
; but default installation of nextcloud has already ~9k php files ; but default installation of nextcloud has already ~9k php files
; see https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.max-accelerated-files ; see https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.max-accelerated-files
opcache.max_accelerated_files=32531 opcache.max_accelerated_files={{ nextcloud_opcache_max_accelerated_files }}
opcache.memory_consumption=256 opcache.memory_consumption={{ nextcloud_opcache_memory_consumption_mb }}
; deconstructor optimizations ; deconstructor optimizations
opcache.fast_shutdown=1 opcache.fast_shutdown={{ nextcloud_opcache_fast_shutdown }}
;opcache.save_comments=1 opcache.save_comments={{ nextcloud_opcache_save_comments }}
; not used if validate_timestamps=0 ; not used if validate_timestamps=0
;opcache.revalidate_freq=1 opcache.revalidate_freq={{ nextcloud_opcache_revalidate_freq }}
opcache.validate_timestamps=0 opcache.validate_timestamps={{ nextcloud_opcache_validate_timestamps }}

View File

@ -6,9 +6,9 @@ group = www-data
listen = 127.0.0.1:9000 listen = 127.0.0.1:9000
pm = dynamic pm = dynamic
pm.max_children = 64 pm.max_children = {{ nextcloud_fpm_max_children }}
pm.start_servers = 32 pm.start_servers = {{ nextcloud_fpm_start_servers }}
pm.min_spare_servers = 24 pm.min_spare_servers = {{ nextcloud_fpm_min_spare_servers }}
pm.max_spare_servers = 48 pm.max_spare_servers = {{ nextcloud_fpm_max_spare_servers }}
;pm.max_requests=500 ;pm.max_requests=500