FrankenPHP vs PHP-FPM: What We Learned Benchmarking Two Real Symfony Apps

TL;DR: FrankenPHP is a good server, but the speed people credit it with comes from worker mode, not from FrankenPHP itself. We benchmarked two real Symfony apps on four setups. Worker mode made HTML pages 2-3x faster and light API calls 6-11x faster, but a real user opening a project in the browser saw only a 6-10% improvement. Worker mode also changes your application more than your infrastructure: on an older Symfony app it leaked data between requests until we found and fixed a shared service. Some of the best findings were plain configuration bugs in the setups we were comparing against.

Every few months someone on our team asks whether we should "just move to FrankenPHP". I get the appeal. You replace nginx (or Apache) and php-fpm with a single binary, you get HTTP/3 and Early Hints thrown in, and the benchmark charts show PHP serving ten times more requests per second.

The trouble is that I can't show a client a chart from a README and call it a plan. I wanted numbers from applications that look like the ones we actually maintain. So I took two Symfony apps, ran each of them on every common PHP setup, and measured.

The first is dynamiczne.info, a side project of mine that already runs on FrankenPHP. The second is, a project-management SaaS we build for a client here at Accesto, I will call it "Accesto Client" from now on. It runs on Apache and php-fpm, and has for years.

Spoiler: FrankenPHP itself turned out to matter much less than I expected. What I found along the way mattered more, and most of it was configuration.

What we compared

The same Symfony application, four ways, each in one container with 2 CPUs:

  • FrankenPHP in worker mode. The app boots once and stays in memory, and every request reuses the same kernel.
  • FrankenPHP in classic mode. Caddy with PHP built in, but Symfony boots from scratch on every request, just as it does under php-fpm.
  • php-fpm behind nginx.
  • php-fpm behind Apache (mpm_event + proxy_fcgi).

Keep the first two apart in your head, because the rest of this article depends on it. FrankenPHP is a web server. Worker mode is a different way of running PHP. When you see an impressive FrankenPHP number, it's almost always about worker mode.

How I measured

  • Load came from k6 on a separate machine, with Accept-Encoding: gzip and OPcache warmed up.
  • For throughput, 64 virtual users hammered each endpoint for 30 seconds. I repeated that three times, rotating the order of the variants, and I report the median.
  • For latency, every variant got the same fixed request rate: 60% of what the slowest one could handle.
  • Every variant got the same php.ini, OPcache settings and preload script. That sounds like a given. It was the hardest part of the whole exercise, and I'll come back to it.
  • I ran everything on two machines, an Apple M3 Max (arm64) and an AMD Ryzen 5825U mini PC (amd64). I only compare variants with each other on the same machine, never one machine with the other.

App 1: dynamiczne.info

dynamiczne.info shows hourly electricity prices in Poland. It has a dashboard, pages for each day and month, a comparison tool and a small public JSON API. It's Symfony 8.1 on PHP 8.5 with PostgreSQL and no ORM. Pages are rendered with Twig and Live Components, so a typical request runs a few queries and then spends a while in templates.

Throughput (arm64, requests per second, median of three)

EndpointFrankenPHP workerFrankenPHP classicphp-fpm + nginxphp-fpm + Apache
Dashboard /240787071
Day page364129121122
Comparison page340146158152
Month page (Postgres-bound)3222
API: prices1,602191173172
API: outlook1,387192149183
API: raw fixing1,710177329299
Static CSS file16,36815,48758,96133,297

Bar chart of dynamiczne.info HTML page throughput for each setup relative to php-fpm with nginx

Bar chart of dynamiczne.info API throughput for each setup relative to php-fpm with nginx

The amd64 machine told the same story: worker mode was 2.7-3.3x faster on HTML and 5-8x on the API, and classic mode stayed within 10% of php-fpm.

Worker mode is where all the speed comes from. HTML pages got 2.2-3.4x faster and JSON endpoints 5-9x. The API gains more because each call does very little, so booting Symfony is a large part of the cost. A page that spends most of its time in Twig and the database has less to gain.

Without the worker, FrankenPHP behaves like php-fpm. Classic mode landed within ±10% of both php-fpm setups on almost every endpoint, and on the raw fixing API it was actually slower: 0.55x of php-fpm on arm64, in all three runs. So if you move to FrankenPHP and leave the worker off, you've changed your web server and that's about it.

nginx is still much better at static files: 59k requests per second against 16k for Caddy. If a CDN sits in front of your app, you'll hardly notice. If your app serves its own assets to a lot of people, you might.

Bar chart of static file requests per second for Caddy, nginx and Apache

Latency at the same load

At the same request rate, the median request in worker mode was 2-4x faster on both pages and API calls. For example, 3.8 ms instead of 9 ms on the prices API, and 8 ms instead of 17-20 ms on the day page. The slowest 1% of requests (p99) was usually better too, but not always. On the arm64 dashboard the worker's p99 was 50 ms, against 28-37 ms for php-fpm. A faster median doesn't automatically mean a shorter tail.

What made no difference

  • CPU architecture. I half expected FrankenPHP to shine on arm64. It didn't: the ratios were the same on both machines, give or take the noise on the amd64 box.
  • Production php.ini and web server tuning. Before the third run I added php.ini-production to every variant, open_file_cache to nginx and EnableSendfile to Apache. The medians moved by less than 10%, some up and some down.
  • The month page. It waits on a PostgreSQL query and manages 2-3 requests per second whatever runs the PHP. No web server will fix a slow query.

Bugs I found in my own production setup

Honestly, the best thing to come out of this wasn't a number. Benchmarking forced me to look closely at a configuration that had been in production for months, and I found three bugs in it:

  1. Caddy was compressing every asset on the fly. FrankenPHP puts its php_server directive ahead of file_server in Caddy's directive order, so my file_server … precompressed block for /assets never ran. One line in the global options fixed it (order file_server before php_server), and static files went from 2,750 to 15,800 requests per second.
  2. Caddy was overwriting every Cache-Control header PHP set. A header block I'd meant as a default for static files replaced the header on every response. That included the no-store on the admin page that shows a new API key exactly once. The fix was a ? prefix (?Cache-Control), which only sets the header if it's missing.
  3. The production image had no php.ini at all. PHP was running on its built-in defaults: display_errors=1, zend.assertions=1, expose_php=1. That didn't slow anything down, but it's not what you want on a public server.

None of this is FrankenPHP's fault. But when one config file replaces two that you've known for a decade, these things slip through, and Caddy's directive order takes some getting used to.

App 2: Accesto Client

dynamiczne.info is small, and I wrote it with worker mode in mind. Accesto Client is the opposite. It's a large Symfony 7.4 application with Doctrine ORM, FOSUserBundle, HWIOAuthBundle, RabbitMQ consumers and websocket servers. Its Apache configuration has grown over the years. It now covers Cloudflare and ALB proxy ranges. On top of that come S3 proxies for the landing page, External Service addons, and X-Frame-Options rules that depend on the Referer.

In other words, a pretty typical PHP application, which makes it the more useful test.

Porting the Apache rules to Caddy

I treated the Apache files as the source of truth and generated the Caddyfile from them. That way long values like the CSP and the proxy ranges were copied, not retyped. Then I ran both images side by side and compared status codes and headers for 24 kinds of request.

Before that comparison I'd have told you the port was finished. It wasn't:

  • Another directive-order trap. In Caddy, respond runs after handle. With a catch-all handle { php_server }, my respond /healthz 200 and the .git block never got a chance to run. Each of them needed its own handle.
  • Caddy happily served .htaccess. Apache blocks .ht* files in its default config. Nobody writes that rule themselves, so nobody thinks to port it.
  • OPcache preloading was quietly switched off. The php-fpm pool sets php_admin_value[opcache.preload]. Preloading happens in the FPM master before any pool starts, though, so the setting is ignored and production preloaded 0 scripts. FrankenPHP reads the same value from php.ini and preloaded 9,179. Had I compared the two as configured, FrankenPHP would have taken credit for something php-fpm gets from one line in php.ini. So I measured php-fpm both ways.

After the fixes, the remaining differences were either intended or harmless. JSON is now gzip-compressed (Debian's mod_deflate doesn't compress application/json). Go normalises header names, so X-MinuteRateLimit-Limit becomes X-Minuteratelimit-Limit. And /.git paths now get a 403 instead of a 404.

Throughput (arm64, requests per second, median of three)

Same method as before: 2 CPUs and 2 GB per container, with MariaDB, Redis and RabbitMQ in their own containers. "Apache + preload" is the production image plus one php.ini line that makes preloading actually work.

EndpointFrankenPHP workerFrankenPHP classicApache + php-fpm (as in production)Apache + php-fpm + preload
/healthz (no PHP)16,05915,44343,40443,940
Static CSS file10,66010,55925,22824,626
Login page2,262232145198
API: list projects1,180170141147
API: one project1,132155112138
API: tasks of a project827154117136

Bar chart of throughput for each setup relative to php-fpm with preload

Chart breaking down where the Accesto Client speed-up comes from

Here's how it looks against the fairest baseline, php-fpm with preloading fixed:

  • Worker mode is 6-11x faster on PHP endpoints. That's more than on dynamiczne.info, because Accesto Client's kernel is far bigger (9,179 preloaded files) and the test data is tiny, so booting the framework is nearly all the work. The login page is the extreme case at 11x, since it's a form and not much else.
  • Classic mode is 1.13-1.17x faster. Unlike on dynamiczne.info, FrankenPHP without the worker did beat php-fpm here. I didn't dig into why. My first suspects would be the extra FastCGI hop, and an FPM pool sized for 50 children on 2 CPUs. Against Accesto Client as it runs in production (no preload), classic mode looks 1.2-1.6x faster, but a third to a half of that comes from the preload bug, not from the server.
  • Fixing preload on its own gives up to 1.36x on the login page and 1.04-1.24x on the API. That's one line in php.ini, without touching the server.
  • Apache serves files 2.4-2.8x faster than Caddy, much like nginx did on dynamiczne.info.

At the same fixed rate, worker mode roughly halves the median response time compared with php-fpm with preload: 7 ms instead of 10.5 ms for a single project, 3.9 ms instead of 6.1 ms for the login page. The slowest requests were noisy in this run. Some went over 100 ms in FrankenPHP classic and in php-fpm, never in the worker, but with one repetition I wouldn't call that a pattern.

Memory goes the other way. Under that load the container used about 550 MB in worker mode, 970 MB in classic mode and 315-420 MB with php-fpm. Classic FrankenPHP was the hungriest of the four, which is worth knowing before you pick instance sizes.

Bar chart of container memory usage under the same load

Does worker mode survive a typical app?

All of the above assumes the app behaves the same when it isn't torn down after every request. For dynamiczne.info that was a rule from day one. Nobody working on Accesto Client has ever had to think about it.

Symfony does a lot of the work for you. Services tagged kernel.reset are reset between requests, and that covers the big ones: Doctrine's entity managers (the identity map gets cleared), the security token storage, Monolog buffers. My first smoke test repeated the same public API requests, mixing authenticated and anonymous calls. The responses stayed stable and nothing leaked.

Then I opened the real app in a browser to measure page loads (more on that below). In worker mode, a project with 400 tasks showed 1,200 tasks, and more with every reload. Classic mode and php-fpm showed exactly 400 every time.

The culprit was PluginReturnHelper, a service from the oldest layer of the codebase. Fifteen controllers use it to build their JSON responses. They add arrays to it, and it serialises everything it has collected. It never clears itself, because under php-fpm it never had to: everything died with the request. In a worker, one instance serves request after request, so each response carried the data of every earlier request on that thread. It wasn't only duplicates, either. /app/projects came back with the tasks from a project someone had opened before. Put two users on the same thread and one of them gets the other's data. I only checked this with one account, but the service has no idea who the user is, so the code alone tells you what happens with two.

The fix was small: implement ResetInterface, tag the service kernel.reset, and Symfony clears it after each request. Finding it was the hard part, and that's the bit I'd most like you to remember:

  • My smoke test passed. It only hit the public API, and the public API doesn't use this service.
  • Searching the code didn't find it either. I'd looked for the obvious suspect, state in static properties, and found 19 classes. MissingMemberHelper caches a user's role on a project, CachedExternalServiceAccessTokenProvider caches ExternalService tokens, and MirrorHelper collects scheduled changes. I haven't audited those yet, and they're still suspect. But the bug that actually bit was an ordinary property on an ordinary shared service, and that describes most Symfony services.

Under php-fpm, state lives "until the end of this request". In a worker it lives "until the worker restarts", which might be thousands of requests later and for somebody else. Symfony has no way of knowing which of your services hold request data unless you tell it.

In fairness, Accesto Client's RabbitMQ consumers are long-running processes too, so some of this state already survives between messages today. But a consumer handles one kind of message on behalf of the system, while a web worker handles every user's requests. Switching Accesto Client to worker mode means auditing every shared service that collects data, not just the 19 static ones. It also means checking the bundles (FOSUserBundle and HWIOAuthBundle are older than worker mode) and testing the real app end to end with more than one user. That's a project, not a config change.

What a user actually sees

Requests per second tell you how a server copes under load. A user opening a project sees something else: the Angular 21 shell loads, fires 16 API calls, and then renders. I measured that with Playwright. A logged-in user opened projects with 30, 150 and 400 tasks, ten page loads per variant and size, with all the fixes above in place.

To keep it close to production, the Angular bundle came from a separate static server playing the CDN (production uses a CDN too). TLS ended at a proxy playing the load balancer. Third-party scripts (fonts, analytics, chat) were blocked so that only our own servers counted.

MetricFrankenPHP workerFrankenPHP classicApache + php-fpm + preloadApache + php-fpm (production)
First Contentful Paint (any size)314-316 ms332-346 ms330-332 ms332-346 ms
Project ready, 30 tasks473 ms525 ms502 ms527 ms
Project ready, 150 tasks510 ms575 ms550 ms570 ms
Project ready, 400 tasks590 ms630 ms645 ms641 ms
Server time, sum of the 16 API calls~90 ms~210 ms~175 ms~200 ms

"Project ready" is the moment every task title is on the page. Largest Contentful Paint comes within about 20 ms of it. The numbers are medians with a cold browser cache. A warm cache made no measurable difference on a local network.

Chart of the time until every task is visible on an Accesto Client project in the browser

So in the browser, the 6-11x from the load test shrinks to 30-60 ms, or 6-10%. Here's why:

  • Worker mode cuts the server's share by more than half, from about 200 ms of PHP time to 90. But the 16 calls run in parallel, so the user waits for the slowest few, not for all of them added up.
  • The first paint is the shell with a loading spinner, and it doesn't touch PHP at all. It takes 315-345 ms whichever server you use.
  • Going from 30 to 400 tasks adds about 120 ms, nearly all of it in the browser. For 400 tasks the API returns half a megabyte of JSON, and Angular has to turn all of it into DOM.

The client was an M3 Max on the same network as the server. On a mid-range laptop or a phone, the JavaScript takes longer and the server's share of the wait shrinks even further. What worker mode really buys you is capacity: the same hardware can serve several times more users before anyone has to wait. For one user on a quiet server, the improvement is small.

So, should you switch?

FrankenPHP is a good server. It's just not magic, and most of what people credit it with comes from somewhere else.

  • The speed comes from worker mode. Without it, FrankenPHP was within 10% of php-fpm on one app and 13-17% faster on the other. With it, HTML got 2-3x faster and light API calls 6-11x. If you don't plan to run the worker, performance isn't much of a reason to migrate.
  • Worker mode changes your application more than your infrastructure. On an app built for it, you get it for free. On a typical Symfony app that's a few years old, you need to audit static and per-request state first. Skip that and you get the nastiest kind of bug: rare, tied to particular users, and invisible in your tests.
  • Users notice far less than load tests suggest. On Accesto Client, 6-11x more throughput turned into a project that loads 6-10% faster. You're buying capacity, not a noticeably faster page.
  • Test worker mode on the real app, in a real browser. The leak that mattered showed up when I opened a project. A code search and an API smoke test both missed it.
  • Check what you're running today before you compare. Accesto Client production setup had OPcache preloading quietly switched off, and two Apache rule files did nothing. dynamiczne.info had no php.ini and Caddy was overriding the app's cache headers. A less careful benchmark would have given FrankenPHP the credit for fixes that take a few lines each.
  • Static files are slower. nginx and Apache served them 2-3.7x faster than Caddy. With a CDN in front, that rarely matters. If your PHP container also serves heavy assets, it does.
  • One config file isn't automatically simpler. Caddy's directive order (php_server before file_server, respond after handle) caused three of the bugs in this article. The Caddyfile is shorter than the Apache config, but it isn't any easier to get right.

Would I move Accesto Client? Classic mode on its own gives a modest speed-up, one process instead of two, and more memory per instance. That's not worth a migration. The worker's 6-11x is worth a lot, but only once the state audit is done. I'd do that audit first anyway, since it pays off for the RabbitMQ consumers whatever web server you end up with.

Caveats

  • Two CPUs per container, one load generator, synthetic traffic. Your own mix of endpoints decides how much of the worker gain you'll actually see.
  • The amd64 machine shares its host with other services, and repeated runs differed by up to 50%. Trust the ratios, not the decimals.
  • Accesto Client ran on its small public-API test dataset. Its API numbers are mostly framework boot time, which flatters worker mode. Pages with heavy queries will gain less, as the month page on dynamiczne.info showed.
  • The browser test ran from a fast client on the local network, with third-party scripts blocked and the websocket servers off. Real users add network latency and slower devices, which makes server differences matter even less.
  • I didn't test HTTP/3, Early Hints or Mercure. They're real FrankenPHP features, but they're a different question.
icon

Hire PHP modernization experts

We work fast and effective, in parallel with releasing new features. Free code review included.

Improve Code

Related posts