Skip to content

Conversation

@sergehardy
Copy link

Hi, first PR on that great project.

Having heavily played with configuration in the past weeks, I have noticed using Prometheus metrics frankenphp_total_threads and frankenphp_total_workers that the default value for num_threads changes whether the worker mode is enabled or not.

In other words, with the following restrictions on my compose stack for the FrankenPHP service:

  deploy:
    resources:
      limits:
        cpus: 2

In classic mode : 4 threads are created
In worker mode with "num : 4" : 5 threads are created.

So if you happen to explicity set num_threads, it has to be > that num to ensure the request thread is created, otherwise FKPHP won't start and will output this error message:

Error: loading initial config: loading new config: frankenphp app module: start: num_threads (4) must be greater than the number of worker threads (4).

docs/config.md Outdated
Comment on lines 115 to 119
If the worker mode is enabled, an additional thread is required to handle the incoming requests,
so the default `num_threads` value is `1 + 2x(number of available CPUs)`.

Thus, in that mode if `num_threads` and `num` are explicitly set, `num_threads` must be strictly greater then `num`.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional thread is always started in-reserve to handle any non-worker mode requests. This block probably better fits into worker.md, somewhere here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, I have moved the section to worker.md

@sergehardy sergehardy force-pushed the fix/doc-config-num-threads branch from 019c95f to ad3b88c Compare November 28, 2025 17:04
@sergehardy sergehardy force-pushed the fix/doc-config-num-threads branch from ad3b88c to f77eca5 Compare November 28, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants