Reduce idle PHP-FPM memory footprint
All checks were successful
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m22s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 2m7s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 2m16s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 2m13s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 2m23s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 3m31s
Cloud Apache Container / Build-and-Push (85) (push) Successful in 2m2s
Cloud Apache Container / Build-FPM-Images (74) (push) Successful in 2m21s
Cloud Apache Container / Build-FPM-Images (80) (push) Successful in 1m23s
Cloud Apache Container / Build-FPM-Images (81) (push) Successful in 2m51s
Cloud Apache Container / Build-FPM-Images (82) (push) Successful in 1m16s
Cloud Apache Container / Build-FPM-Images (83) (push) Successful in 2m4s
Cloud Apache Container / Build-FPM-Images (84) (push) Successful in 2m6s
Cloud Apache Container / Build-FPM-Images (85) (push) Successful in 1m17s
Cloud Apache Container / Build-Shared-httpd (push) Successful in 26s
All checks were successful
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m22s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 2m7s
Cloud Apache Container / Build-and-Push (81) (push) Successful in 2m16s
Cloud Apache Container / Build-and-Push (82) (push) Successful in 2m13s
Cloud Apache Container / Build-and-Push (83) (push) Successful in 2m23s
Cloud Apache Container / Build-and-Push (84) (push) Successful in 3m31s
Cloud Apache Container / Build-and-Push (85) (push) Successful in 2m2s
Cloud Apache Container / Build-FPM-Images (74) (push) Successful in 2m21s
Cloud Apache Container / Build-FPM-Images (80) (push) Successful in 1m23s
Cloud Apache Container / Build-FPM-Images (81) (push) Successful in 2m51s
Cloud Apache Container / Build-FPM-Images (82) (push) Successful in 1m16s
Cloud Apache Container / Build-FPM-Images (83) (push) Successful in 2m4s
Cloud Apache Container / Build-FPM-Images (84) (push) Successful in 2m6s
Cloud Apache Container / Build-FPM-Images (85) (push) Successful in 1m17s
Cloud Apache Container / Build-Shared-httpd (push) Successful in 26s
Opcache: - memory_consumption: 128MB → 64MB (most WordPress sites use <40MB) - max_accelerated_files: 10000 → 4000 (sufficient for WordPress) - revalidate_freq: 2s → 60s (reduce stat() calls in production) - enable_cli: Off (don't cache scripts run from command line) FPM workers: - process_idle_timeout: 10s → 5s (faster worker teardown when idle) - max_requests: 500 → 200 (recycle workers sooner to release leaked memory) These changes primarily reduce the baseline memory of idle containers where opcache was reserving 128MB even for small sites. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1496,7 +1496,15 @@ ldap.max_links = -1
|
||||
;dba.default_handler=
|
||||
|
||||
[opcache]
|
||||
; see /etc/php.d/10-opcache.ini
|
||||
; Optimized for shared hosting — reduce idle memory footprint
|
||||
; Default 128MB is excessive for most WordPress sites
|
||||
opcache.memory_consumption = 64
|
||||
opcache.interned_strings_buffer = 8
|
||||
opcache.max_accelerated_files = 4000
|
||||
; Revalidate files every 60s in production (reduces stat() calls)
|
||||
opcache.revalidate_freq = 60
|
||||
; Don't waste memory on CLI scripts
|
||||
opcache.enable_cli = Off
|
||||
|
||||
[curl]
|
||||
; A default value for the CURLOPT_CAINFO option. This is required to be an
|
||||
|
||||
@@ -82,8 +82,8 @@ if [ "$CONTAINER_ROLE" != "httpd_only" ]; then
|
||||
|
||||
PHP_FPM_PM=${FPM_PM:-ondemand}
|
||||
PHP_FPM_MAX_CHILDREN=${FPM_MAX_CHILDREN:-$calc_max_children}
|
||||
PHP_FPM_PROCESS_IDLE_TIMEOUT=${FPM_PROCESS_IDLE_TIMEOUT:-10s}
|
||||
PHP_FPM_MAX_REQUESTS=${FPM_MAX_REQUESTS:-500}
|
||||
PHP_FPM_PROCESS_IDLE_TIMEOUT=${FPM_PROCESS_IDLE_TIMEOUT:-5s}
|
||||
PHP_FPM_MAX_REQUESTS=${FPM_MAX_REQUESTS:-200}
|
||||
|
||||
# Dynamic mode fallbacks (used if user overrides FPM_PM=dynamic)
|
||||
PHP_FPM_START_SERVERS=${FPM_START_SERVERS:-2}
|
||||
|
||||
Reference in New Issue
Block a user