Skip to content

Default Apache and PHP-FPM settings sized for a typical application (v6) - #433

Open
mistraloz wants to merge 1 commit into
thecodingmachine:v6from
mistraloz:feat/v6-apache-fpm-defaults
Open

mistraloz wants to merge 1 commit into
thecodingmachine:v6from
mistraloz:feat/v6-apache-fpm-defaults

Conversation

@mistraloz

@mistraloz mistraloz commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The v5 defaults do not fit a typical application: keep-alive holds the mod_php processes, 150 mod_php processes of 100 MB exhaust a 2-4 GB container in a traffic peak, and 5 PHP-FPM workers leave CPU idle when the requests wait for a database.

What

v5 v6
apache: APACHE_KEEPALIVE On Off
apache: APACHE_MAX_REQUEST_WORKERS 150 20
fpm: PHP_FPM_PM_MAX_CHILDREN (start, spare) 5 (2, 1-3) 10 (4, 2-6)
fpm: APACHE_MAX_REQUEST_WORKERS (threads) 150 1024
ListenBacklog 511 4096

The benchmark measured 30 mod_php processes with 16 MB pages. The tuning simulator gives 20 for business applications of 64-128 MB per request: 30 run out of memory in a peak, 20 still saturate the CPU behind a reverse proxy. The simulator of this branch uses these defaults.

Tests

variant-apache.sh (12) and variant-fpm.sh (21) pass on PHP 8.4.

…tion (v6)

- apache variant: keep-alive off, up to 20 mod_php processes (was On and 150)
- fpm variant: 10 PHP-FPM workers (was 5), built-in Apache up to 1024 threads
  (was 150)
- ListenBacklog 4096 (was 511)

The capacity benchmark measured these settings with 30 mod_php processes and
16 MB pages; the tuning simulator gives 20 processes for business applications
of 64 to 128 MB per request, which run out of memory with 30 in a traffic peak.
@mistraloz
mistraloz force-pushed the feat/v6-apache-fpm-defaults branch from a5657b9 to addd522 Compare November 13, 2026 04:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant