Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Laravel Octane worker count#52133

Unanswered
sts-ryan-holton asked this question inQ&A
Jul 15, 2024· 1 comments· 2 replies
Discussion options

Hi, Laravel Octane states that it'll create aworker for each CPU core. I'm wondering here, how many requests then can an actual CPU core handle or is it better to actually just set the number of workers significantly higher than what Octane thinks it should start?

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

Every worker can only handle 1 request at a time. So if the worker count is equal to the CPU count it could happen that there are not enough workers to fully utilize your CPU cores if many workers are simultaneously busy fetching from cache/database/filesystem (which will make them block).

So a good default setting would be to use around 2x times as many workers as you have CPU cores to ensure that the CPUs are being used to a fuller extent.Frankenphp will actually create 2x the amount of workers, which is probably a better default thanSwoole which will does 1x CPU cores. TheSwoole default probably comes from it most often being used in its async mode, where 1x the number of CPU cores is enough to fully utilize all CPU cores. Laravel Octane does not run asynchronous though so it benefits from a higher amount of workers.

Why not use many more workers then? The tradeoff for having more workers is that you also consume more memory. The bottleneck will more often be your CPU though.

You must be logged in to vote
2 replies
@rei-gun
Comment options

is there a way to see the number of running workers?supervisorctl status always shows 1 octane only

@AlliBalliBaba
Comment options

FrankenPHP exposes Prometheusmetrics for that. If you just want to debug, you can also ping the admin api directly (usually running on port 2019.

# ping metrics for debuggingcurl http://localhost:2019/metrics# see all thread states for debuggingcurl http://localhost:2019/frankenphp/threads

In the newer FrankenPHP versions you can also let threads spawn automatically, so I'd recommend something like 5-10x CPU cores viamax_threads.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@sts-ryan-holton@rei-gun@AlliBalliBaba

[8]ページ先頭

©2009-2025 Movatter.jp