Related posts
- clang, PHP 8.4 and the missing zlib: the last round of compiled PHP
The final round of the compiled-PHP question: CentminMod's function alignment on its own, a clang build and PHP 8.4, with every module compiled from source. clang is the only build with a repeatable edge (+3 % on XenForo), 8.4 is slower than 8.5, and my earlier source builds were missing zlib.
- Is a compiled PHP faster? Four builds, one Xeon, and a JIT that makes the question moot
Sury packages, Ubuntu's archive, and PHP built from source with -O3 -march=native and only the modules XenForo needs. On a PHP-bound forum the difference was inside the noise, and the reason is the tracing JIT.
- Everything on: LTO, PGO and -march=native made PHP 8.5 slower
A follow-up to the four-build PHP test: turn on every CentminMod compiler option, add LTO and two-stage PGO trained on real XenForo traffic, and compile every module from source. The result is 5 to 10 % slower than the distribution package, not faster.
The last cycle compared six web servers in front of the same PHP-FPM pool and found that the server core was noise: every nginx-family build landed inside the run-to-run spread, and the 100x factor was the generic page cache. That left the obvious next question.
If the web server does not decide, does the way PHP itself runs?
PHP-FPM is the default in my provisioning script. The alternatives have loud claims: FrankenPHP embeds PHP in a Go server, RoadRunner and Swoole keep the application in memory between requests, Workerman and ReactPHP and AMPHP turn PHP into an event loop, and PHP-CGI is the old baseline everybody replaced. So this cycle put all of them on the same workload, and then put the three applications on the ones that can actually run them unmodified.
The short answer: keep PHP-FPM. For WordPress, XenForo and Chevereto the request time is the database and the template, not the SAPI. The persistent-worker runtimes are genuinely 1.4-1.6x faster, but they are an application port, not a server swap.
Two questions, two test beds#
Comparing a server that runs the application unmodified with one that needs a rewritten front controller is not one benchmark. I used two layers.
Layer 1 — the real applications. PHP-FPM 8.5, PHP-CGI 8.5 and FrankenPHP 1.14 (which embeds PHP 8.6) served the actual WordPress, XenForo and Chevereto document roots over TLS on
:443, one server at a time, with no page cache — a cache would hide the PHP path being measured. Same database, same Valkey, same files, 100 connections, 8 seconds, three rounds, order reversed on even rounds. Member tiers used real session cookies.Layer 2 — the runtime ceiling. A shared application-shaped workload: a 60-file framework bootstrap, two MariaDB statements, one Valkey
GET, a 13 KB template with 160 rows, a SHA-256 of the page and a JSON round-trip. PHP-FPM, PHP-CGI, FrankenPHP classic, FrankenPHP worker, RoadRunner 3.0, Swoole 6.2, OpenSwoole, Workerman 5.2, ReactPHP 1.12, AMPHP 3.4 and PHP’s built-in server each got 12 workers (ReactPHP and AMPHP: twelve event-loop processes sharing the port), the same OPcache and tracing JIT (opcache.jit=tracing, 64 MB), the same Angie in front, gzip off,wrk -t4 -c64 -d8s, 3 rounds. CPU is each backend’s cgroup usage divided by the requests completed; Angie’s CPU is reported separately.OpenLiteSpeed was left out for the same two reasons as last cycle: its LSCache module only stores responses an application plugin marks (Chevereto and XenForo have no such plugin), and its fast path is LSAPI, a different PHP SAPI, so measuring it against PHP-FPM would compare two PHP builds rather than two servers.
The host is the same disposable 6-core/12-thread Xeon E-2236 with 62 GB RAM and NVMe RAID0, mitigations off, restored to its pristine package manifest afterwards.
Layer 2: the same work, every execution model#
Three things stood out.
The bootstrap is not where the time goes. The 60-file include costs about 0.05 ms with OPcache; the two queries and the render dominate. That is why PHP-FPM, which pays the bootstrap on every request, and FrankenPHP worker, which boots once, land in the same band. The worker win exists, but only inside FrankenPHP: classic 7.6k → worker 9.6k req/s (+26%) and p99 13.3 → 8.3 ms (-38%).
The framework around the worker matters more than the worker. RoadRunner (0.90 ms of CPU per request) and AMPHP (0.97) spend as much on PSR-7 request objects, Goridge IPC or the event loop as the bootstrap saves. Workerman and Swoole avoid that layer and halve the CPU: 0.37-0.43 ms per request against 0.60 for FPM. ReactPHP has the lowest CPU per request of all (0.28 ms) and the worst throughput at 100 connections (2.2k req/s, 27.9 ms p50): one event loop per process is efficient and does not scale for this concurrency profile.
CGI is not slower than FPM. It is inside the spread, and it uses far more memory in the real-app layer because it has no shared pool manager. There is no production reason to move to it.
Layer 1: the applications you actually run#
No page cache, 100 connections, medians of three rounds.
0non-2xx in every row.WordPress and XenForo are application-bound. A WordPress post renders in 143-157 req/s and a XenForo thread in 324-348 req/s across three completely different execution models; the difference between servers is smaller than some servers’ own round-to-round spread. FrankenPHP is competitive there — and then loses 44% on Chevereto (830 vs 1,482 req/s, 11.2 ms of PHP CPU against 5.4), with no redirects and no errors, just a heavier request path for that application.
This is the part the marketing tables cannot show: the server does not make the page cheaper. Two database statements, a 13 KB render and a 5 ms CPU budget per request are what they are.
The verdict#
$_ENVnot being reset. WordPress, XenForo and Chevereto are not written for it; you would need a worker-safe front controller and a compatibility pass, and XenForo would need an add-on.The security finding that came out of the same run#
The cycle’s other change started as an audit item and turned into a real leak. The guest caches bypassed on a fixed list of session cookie names and treated every other cookie as page-neutral. A plugin session or an SSO token outside that list could render a personalised page that was then stored for every guest.
The caches are now default-deny: one
mapwith one PCRE pass per request (and no regex when there is no Cookie header) accepts only analytics/consent cookies, CDN and bot-management cookies, and the applications’ own page-neutral guest cookies. Anything unknown is rendered by PHP and never stored. A language selector still bypasses, because it changes the page until it joins the cache key.The end-to-end Anubis run caught what the source tests could not. Anubis sets
techaro.lol-anubis-auth-*on every visitor; the first version of the rule treated it as unknown, so every request on an Anubis-fronted host became a cache bypass. With the pass cookie in the allowlist the same request is a cache hit, and Anubis costs 0.0008 ms of CPU per request.That is the argument for keeping the disposable-host audit: the unit tests knew the rule, the cookie suite knew the applications, and only a request through the real proxy chain found the cookie the proxy itself sets.
What was measured, in one place#
--optimizeruns: 3,076 configuration facts, zero differences.The harness is in the repository:
tests/stress-site/php-server-shootout.shandtests/stress-site/php-appsim/. The full method and every row are in the cycle’sAUDIT-20261123-1.21.61.md, linked from the repository. Numbers age; the method is what you can repeat.