-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: explain difference between num_threads and worker.num #1198
Comments
Num threads is the total number of php threads (this doesn't affect the number of go threads). Worker threads consume php threads (must be less or equal to total threads). Non worker threads handle requests not covered by the worker. For example, an advanced configuration might delegate api requests to a worker, but authentication to a non-worker. |
Thanks, makes sense. So for a project with just one worker and nothing else, you could just set I found that the Related to this, I found your advice on tweaking GOMAXPROCS: Would you still recommend this today? |
I'd say that it largely depends on your load and what you are doing in PHP. We're often dealing with "ideal" situations when doing load tests and figuring out the bottlenecks. That is probably not the answer you want though. :) Just remember one worker means you can handle only one request at a time, so if your php script takes a full 10s to return, you won't be able to accept another request until another completes. If your requests are not very CPU-intensive, you can often have far more workers than CPUs (but one or two workers per CPU is usually more efficient). These threads are analogous to fpm-workers, and the tuning of the numbers is very similar (you don't want vastly more fpm-workers than CPUs, or your max RPS will actually be lower than what it is actually possible to achieve; keeping in mind memory usage as well, because if you overcommit, one bad request can bring the ire of the OOM-Killer). The main thing is hardware. Go is multi-threaded and is meant to run on servers/desktops with lots of CPUs. If you have too few CPUs, performance will suffer due to context switching. |
Thanks! With "one worker" I meant "one worker configuration entry"
In, which case, a config with substituted env variables might be:
|
What happened?
It's not clear to me what I need to configure if I'm only using the worker mode (in Laravel).
No matter what I do, frankenphp seems to always start with 48 threads (2x my CPU).
htop:
I tried harcoding it to 2 threads, but it's still the same outcome
Maybe this is expected?
I'd be nice to have an explanation in the docs for the difference/relation between
frankenphp.num_threads
andfrankenphp.worker.num
Does one supersede the other? Do they configure different things?
Build Type
Docker (Debian Bookworm)
Worker Mode
Yes
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Relevant log output
No response
The text was updated successfully, but these errors were encountered: