Skip to content
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

Fix use the physical CPU count from Fastify #7988

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

JHyeok
Copy link
Contributor

@JHyeok JHyeok commented Mar 4, 2023

Modify to use the number of physical CPUs, not the logical number of CPUs with hyperthreading applied, when using Cluster mode.
Change from the alpine image to slim to fix the /bin/sh: lscpu: not found error.

Working with clusters of Node.js processes it is common to see code using os.cpus().length as the number of child workers to fork.
For some workloads this can negatively impact performance on CPUs that use simultaneous multithreading (SMT).
Latency is doubled because two processes share the same physical CPU core to get their work done.
Additionally there is memory spent for each running worker, as well as time to spawn their processes.
It is better to fork no more child processes than there are physical cores.

@NateBrady23 NateBrady23 merged commit fe2ff26 into TechEmpower:master Mar 7, 2023
JHyeok added a commit to JHyeok/FrameworkBenchmarks that referenced this pull request Mar 16, 2023
NateBrady23 pushed a commit that referenced this pull request Mar 17, 2023
franz1981 pushed a commit to franz1981/FrameworkBenchmarks that referenced this pull request Jun 23, 2023
franz1981 pushed a commit to franz1981/FrameworkBenchmarks that referenced this pull request Jun 23, 2023
@JHyeok JHyeok deleted the fix-fastify-cpu-count branch August 4, 2023 10:24
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