You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For each request, there'll be a 2-second wait... the real answer is: "it depends."
For example, if you have 2 cores in cgi-mode: the first two requests will take 2 seconds, with the remaining 3 requests will wait for the first two requests to finish in a queue. So these first two requests will wait two seconds, the next two, four seconds, and the final one six seconds. You can override this with the num_threads setting in your Caddyfile:
frankenphp {
num_threads 48
}
In worker mode, you can override the number of workers, for example, for 48 workers:
frankenphp {
worker testdata/index.php 48
}
This means the first 48 requests would only have to wait 2 seconds. Therefore all 5 requests would be handled simultaneously.
Surely there's some limit to the number of workers though, no? You can't just set it to 100k workers. You'd have to set the workers relative to the available computing resources as well as how compute-intensive the application is - finding some equilibrium that maximizes throughout. Any tips for that?
Surely there's some limit to the number of workers though, no?
Yes, hardware/OS limits. If your hardware can handle 100k threads, you can configure 100k threads.
You'd have to set the workers relative to the available computing resources as well as how compute-intensive the application is - finding some equilibrium that maximizes throughout. Any tips for that?
It largely depends on whether you're memory and/or CPU-constrained (on the hardware level), your application and its memory/CPU usage.
It takes some art to get it to the best like tuning fpm. However, if you already have fpm configured, it will likely be about the same (if not less).
I hope it will have similar behavior to fpm, which spawns processes and does not depend on my cores but rather on memory.
Yes, it spawns processes like fpm (fpm doesn't care about memory though, or how many cores you have). However, the default number of maximum processes is very different. IIRC, FPM defaults are some incredibly low numbers, like 10 workers, but Frankenphp's default is something like 2x the number of cores on your machine. So, it may require tuning, just like any other server software, to find the right balance for your application.
I can't test it out because it doesn't have support for Linux/arm64.
@dunglas, are we just missing a build here, or does it not support arm64? I think we are just missing a build in the build matrix.
Activity
withinboredom commentedon Dec 21, 2023
For each request, there'll be a 2-second wait... the real answer is: "it depends."
For example, if you have 2 cores in cgi-mode: the first two requests will take 2 seconds, with the remaining 3 requests will wait for the first two requests to finish in a queue. So these first two requests will wait two seconds, the next two, four seconds, and the final one six seconds. You can override this with the
num_threadssetting in your Caddyfile:In worker mode, you can override the number of workers, for example, for 48 workers:
This means the first 48 requests would only have to wait 2 seconds. Therefore all 5 requests would be handled simultaneously.
Does that help?
nickchomey commentedon Dec 21, 2023
Surely there's some limit to the number of workers though, no? You can't just set it to 100k workers. You'd have to set the workers relative to the available computing resources as well as how compute-intensive the application is - finding some equilibrium that maximizes throughout. Any tips for that?
foremtehan commentedon Dec 22, 2023
Thanks
I hope it will have similar behavior to fpm, which spawns processes and does not depend on my cores but rather on memory.
I can't test it out because it doesn't have support for Linux/arm64.
withinboredom commentedon Dec 22, 2023
Yes, hardware/OS limits. If your hardware can handle 100k threads, you can configure 100k threads.
It largely depends on whether you're memory and/or CPU-constrained (on the hardware level), your application and its memory/CPU usage.
It takes some art to get it to the best like tuning fpm. However, if you already have fpm configured, it will likely be about the same (if not less).
Yes, it spawns processes like fpm (fpm doesn't care about memory though, or how many cores you have). However, the default number of maximum processes is very different. IIRC, FPM defaults are some incredibly low numbers, like 10 workers, but Frankenphp's default is something like 2x the number of cores on your machine. So, it may require tuning, just like any other server software, to find the right balance for your application.
@dunglas, are we just missing a build here, or does it not support arm64? I think we are just missing a build in the build matrix.
static: build with PHP 8.6 (#2861)