Performance improvement ideas #1042
Replies: 3 comments 16 replies
-
Improvements are always good, but isn't 90,000 rps far beyond anything anyone is realistically going to need? The bottleneck very much doesn't seem like the hand-off from caddy to php at that point (which is what a hello world is effectively measuring, no?) So, I wonder if there should be a focus on setting up some standardized benchmarking suite of real world php workloads - laravel (normal and octane), some sort of fphp workers web app, WordPress without workers etc...? And compare it to php-fpm with caddy and nginx, openlitespeed etc Whatever tests like that reveal - be it that fphp is faster or has some genuine bottlenecks - would be very useful to know |
Beta Was this translation helpful? Give feedback.
-
The document root is also cached in worker mode (#1002 added cache for both modes). |
Beta Was this translation helpful? Give feedback.
-
I think I realized why 10 workers is the magic number where the 'Hello World' is most efficient. It's basically about CPU context switching and to some degree unavoidable. I think the only way to make this more efficient would be to autoscale the number of PHP Threads based on the load instead of having a fixed number. While this would be a cool feature, it's probably not trivial to implement. I think FPM also has a similar mode. |
Beta Was this translation helpful? Give feedback.
-
This thread is for gathering some recent and potential performance improvements in frankenphp so I won't forget them:
ts_resource(0)
once per thread perf: cgi-mode 1700% improvement #933$_SERVER
is accessed (currently only true for cgi mode)Here's a flamegraph I labeled in MS Paint to showcase the current work done in a worker 'Hello World' request without
file_server
:Here's a graph showcasing how one can finangle the number of workers for a maximum RPS for a 'Hello world' (kudos to chatgpt). This was done with 20 CPU cores on a custom branch with
php_import_environment_variables
disabled and no handles. I cannot yet explain why contention significantly increases on higher worker counts.Note that the plain Caddy
respond "Hello World"
will currently manage around 180.000 RPS in the same setup.Beta Was this translation helpful? Give feedback.
All reactions