Performance of classic mode vs PHP-FPM #1981
Replies: 7 comments 89 replies
-
In what way, exactly, do you think they drew the wrong conclusion? |
Beta Was this translation helpful? Give feedback.
-
Not to a measurable extent, if one at all. 99% of the execution time in php projects is inside php. Both FrankenPHP and php-fpm use the same, official php runtime, except that FrankenPHP uses the ZTS instead of the NTS version. With PHP 8.4/8.5 that difference is around 0.1% average, up to at most 0.5% in my testing in favour of NTS using phoronix-test-suite and wrk on x86_64-linux. A meaningless difference that is more than made up for by better compilation options (such as -O3 instead of -O2). FrankenPHP also has the added benefit of not relying on unix sockets to communicate with another service, so the two are virtually identical. You should however try not to use the static binary we provide. It's compiled with -Os -march=generic, targeting glibc 2.17, so we're intrntionally leaving performance on the table for broader compatibility. If you want maximum performance, compile php (and FrankenPHP) from source with -Ofast -march=native and some extra aggressive optimisations. If you want great performance that's compiled for your platform, look at https://rpms.henderkes.com. The el9 version is compiled with -march=x86-64-v2, the el10 with -v3, as that's the platform requirement. If you want php-fpm, just use your system provided version. We're looking at 5% performance difference at most, that's just not worth the hassle of the first option imo. Tl;dr: no performance difference between FrankenPHP (non-worker) and php-fpm. Prefer better compilation options instead. |
Beta Was this translation helpful? Give feedback.
-
|
So it means that I just need to add worker mode to FPM and we are on par? :) That won't happen in 8.6 but it should introduce better event loop bits for that so maybe 8.7 could bring it in but we will see. It's not actually that difficult to add. |
Beta Was this translation helpful? Give feedback.
-
|
So I just did my own benchmarks to verify the results and they... somewhat line up? Although my figures are rather low... Edit: xdebug was on, ignore. Testing
|
Beta Was this translation helpful? Give feedback.
-
|
Trying to recreate the results with similar configuration, using php-fpm from remi modular EL10 repo, nginx from EL10 repo: PHP 8.4.14 (cli) (built: Oct 21 2025 19:23:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine
Zend Engine v4.4.14, Copyright (c) Zend Technologies
with Zend OPcache v8.4.14, Copyright (c), by Zend TechnologiesFrankenPHP from my own repo: PHP 8.4.14 (cli) (built: Oct 24 2025 03:24:04) (ZTS gcc 14.2.1 x86_64)
Copyright (c) The PHP Group
Built by Static PHP <https://static-php.dev> #StandWithUkraine
Zend Engine v4.4.14, Copyright (c) Zend Technologies
with Zend OPcache v8.4.14, Copyright (c), by Zend Technologiesphp-fpm config: ( Nginx config: server {
listen 80;
root /var/www/html;
index index.php;
access_log off;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_keep_conn on;
}
}Caddyfile ( Results (markup with AI):
|
Beta Was this translation helpful? Give feedback.
-
|
Seems like the >25 connections "issue" wasn't limited to the local machine there, but also happens on my other pc, ionos vps (0.5vcore, so ignore) and 4 core oracle VM. RPS is higher but latency shoots through the roof - I guess that's what @withinboredom was saying with connection closing becoming extremely delayed? Edit: caddy + fpm shows similar latency to FrankenPHP, but serves RPS roughly comparable (~-10%) compared to nginx. Picture dumping because I can't get it nicely formatted on GitHub:
|
Beta Was this translation helpful? Give feedback.
-
@withinboredom setting GOMAXPROCS to high values seems to affect the whole thing very negatively. |
Beta Was this translation helpful? Give feedback.






Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
Just wondering if anyone has any thoughts on this: https://tideways.com/profiler/blog/testing-if-franken-php-classic-mode-is-faster-and-more-scalable-than-php-fpm
Their conclusion was that FPM and FrankenPHP in Classic mode were similar. But looking at the benchmarks more closely, it looks like FPM would actually be faster and scale better in many common web app scenarios.
Are these results as expected? I use worker mode for my own apps, but I’m trying to decide if I’d be better off sticking with FPM for third party apps that won’t work with worker mode (eg. WP).
I’m running those apps behind a load balancer that takes care of compression, early hints, SSL termination etc. So those benefits of FrankenPHP aren’t a factor in this particular decision - just performance.
I’d certainly prefer to not have to deal with things like FPM pools, but not at the expense of performance. I’ve seen a few people say FrankenPHP is faster even in Classic mode but I’m unsure about that now.
Beta Was this translation helpful? Give feedback.
All reactions