Skip to content

Kévin Dunglas

Founder of Les-Tilleuls.coop (worker-owned cooperative). Creator of API Platform, FrankenPHP, Mercure.rocks, Vulcain.rocks and of some Symfony components.

Menu
  • Talks
  • Resume
  • Sponsor me
  • Contact
Menu

FrankenPHP 1.3: Massive Performance Improvements, Watcher Mode, Dedicated Prometheus Metrics, and More

Posted on November 13, 2024November 14, 2024 by Kévin Dunglas

I’m thrilled to announce the immediate availability of FrankenPHP 1.3, just in time for SyliusCon, where I’ll be presenting this new version this afternoon.

First of all, I’d like to thank all the contributors, and in particular Alexander Stecher and Rob Landers, the other two project maintainers, who have done a titanic job.

An incredible amount of work has gone into version 1.3. It contains numerous new features and bug fixes and a major refactoring that has significantly improved FrankenPHP’s performance. Let’s dive into the details!

54% More Efficient Than the Previous Version

Alexander has carried out a major overhaul of the internals of our thread engine and optimized the creation of the $_SERVER superglobal. The results are breathtaking: according to our benchmarks, when correctly tweaked, version 1.3 can handle 54% more requests with the same hardware than version 1.2.5 (which was already several orders of magnitude more efficient than conventional PHP installations)!

These changes are transparent for end-users of FrankenPHP.

If you’re interested in the changes made to the Go code, consult the “Performance Improvements” section of the changelog.

This isn’t the end of the performance story: new enhancements are on the way, some of which are already ready and will arrive very soon in an upcoming 1.3.1 version.

File Watchers

FrankenPHP 1.3 includes a new feature dedicated to the developer experience: file watchers.

You can now specify a list of files (PHP scripts, templates, config files…) that FrankenPHP will monitor. When one of these files is changed, the worker will be automatically restarted in the background. You no longer need to restart the server manually, you can just press the “refresh” button on your browser (or even better, use Hot Module Reloading if your framework supports it).

To do this, after testing several solutions, we chose to use the brand-new e-dant/watcher library, which is formidably efficient and works on all platforms. It enables FrankenPHP to monitor directories containing thousands of files without any slowdown. Many thanks to Will for its help in integrating the library.

To enable this feature, just add the new. watch directive to your worker configuration:

{
	frankenphp {
		worker {
			file  /path/to/app/public/worker.php
			watch
		}
	}
}

The default pattern will work with popular frameworks including Laravel, Symfony, and API Platform.

This new feature also has an interesting side-effect for Symfony-based projects, and other projects compiling files or warming caches at build time: this will be done instantly and in the background when a file is modified, further enhancing the developer’s experience.

It’s also possible to configure explicitly the files to watch:

{
	frankenphp {
		worker {
			file  /path/to/app/public/worker.php
			watch /path/to/app # watches all files in all subdirectories of /path/to/app
			watch /path/to/app/*.php # watches files ending in .php in /path/to/app
			watch /path/to/app/**/*.php # watches PHP files in /path/to/app and subdirectories
			watch /path/to/app/**/*.{php,twig} # watches PHP and Twig files in /path/to/app and subdirectories
		}
	}
}

Read the new documentation entry about file watchers to learn more about this new feature.

New Prometheus Metrics

Because it is built on top of Caddy, FrankenPHP has provided a Prometheus/OpenMetrics endpoint since day one. Version 1.3 introduces new metrics dedicated to FrankenPHP threads and workers:

  • frankenphp_busy_threads: shows current PHP threads processing PHP scripts (including workers waiting for requests)
  • frankenphp_total_threads: shows the total number of running PHP threads
  • frankenphp_[worker]_busy_workers: shows how many workers are currently processing requests
  • frankenphp_[worker]_total_workers: shows the total amount of workers
  • frankenphp_[worker]_worker_request_count: shows the total requests processed by each worker
  • frankenphp_[worker]_worker_request_time: shows the total time taken to process requests

Among other use cases, these new metrics can be monitored for autoscaling, as well as to tweak FrankenPHP’s configuration to achieve the best possible performance and efficiency.

Kudos to Rob Landers for this great addition!

Graceful Worker Failures Handling

More explicit errors will be displayed when a worker script is crashing, and FrankenPHP will now try to automatically “heal” the worker when possible. Also contributed by Rob.

Mercure 0.17

FrankenPHP 1.3 includes the brand new version of the Mercure real-time solution, the easiest way to push data in real-time from your PHP apps directly to the browser of your users!

One Line Install Script

Thanks to Pulkit Kathuria, it’s also possible to install FrankenPHP’s static binaries (which include PHP and many extensions) using a single command:

curl https://frankenphp.dev/install.sh | sh

By the way, the static binary now includes ext-parallel, FrankenPHP’s ideal companion for developing PHP scripts that execute functions in parallel:

<?php
$runtime = new \parallel\Runtime();

$future = $runtime->run(function(){
    for ($i = 0; $i < 500; $i++)
        echo "*";

    return "easy";
});

for ($i = 0; $i < 500; $i++) {
    echo ".";
}

printf("\nparallel programming is %s\n", $future->value());

Bug Fixes

Last but not least, version 1.3 includes a bunch of fixes, including crashes when using systems or the putenv() function. FrankenPHP now also supports FreeBSD.

Consult the full changelog for more details.

Supporting the Project

FrankenPHP is fast becoming the must-have solution for modern PHP application deployment.

Feel free to sponsor me on GitHub and give the project a star to support the project.
My company, Les-Tilleuls.coop, also offers professional support, custom development, and training for FrankenPHP, PHP, and many other technologies. Get in touch with us!

Related posts:

  1. The PHP Revolution Is Underway: FrankenPHP 1.0 Beta
  2. FrankenPHP: The Modern Php App Server, written in Go
  3. Running Laravel Apps With FrankenPHP (Laracon EU)
  4. PHP and Symfony Apps As Standalone Binaries

2 thoughts on “FrankenPHP 1.3: Massive Performance Improvements, Watcher Mode, Dedicated Prometheus Metrics, and More”

  1. Guillaume Ponty says:
    November 13, 2024 at 9:20 am

    Congrats! Are we good to migrate to 1.3 now?

    Reply
  2. Silvio says:
    November 13, 2024 at 12:09 pm

    Amazing! waiting for the 1.3-php8.2-bookworm build!

    Thank you!

    Reply

Leave a ReplyCancel reply

Social

  • Bluesky
  • GitHub
  • LinkedIn
  • Mastodon
  • X
  • YouTube

Links

  • API Platform
  • FrankenPHP
  • Les-Tilleuls.coop
  • Mercure.rocks
  • Vulcain.rocks

Subscribe to this blog

Top Posts & Pages

  • FrankenPHP: The Modern Php App Server, written in Go
  • Develop Faster With FrankenPHP
  • FrankenPHP 1.3: Massive Performance Improvements, Watcher Mode, Dedicated Prometheus Metrics, and More
  • JSON Columns and Doctrine DBAL 3 Upgrade
  • Securely Access Private Git Repositories and Composer Packages in Docker Builds
  • How to debug Xdebug... or any other weird bug in PHP
  • Preventing CORS Preflight Requests Using Content Negotiation
  • Symfony's New Native Docker Support (Symfony World)
  • Running Laravel Apps With FrankenPHP (Laracon EU)
  • PHP and Symfony Apps As Standalone Binaries

Tags

Apache API API Platform Buzz Caddy Docker Doctrine FrankenPHP Go Google GraphQL HTTP/2 Hydra hypermedia Hébergement Javascript JSON-LD Kubernetes La Coopérative des Tilleuls Les-Tilleuls.coop Lille Linux Mac Mercure Messagerie Instantanée MySQL performance PHP Punk Rock Python React REST Rock'n'Roll Schema.org Security SEO SEO Symfony Symfony Live Sécurité Ubuntu Web 2.0 webperf XHTML XML

Archives

Categories

  • DevOps (85)
    • Ubuntu (68)
  • Go (18)
  • JavaScript (46)
  • Mercure (7)
  • Opinions (91)
  • PHP (171)
    • API Platform (77)
    • FrankenPHP (10)
    • Laravel (1)
    • Symfony (97)
    • Wordpress (6)
  • Python (14)
  • Security (15)
  • SEO (25)
  • Talks (46)
© 2025 Kévin Dunglas | Powered by Minimalist Blog WordPress Theme