-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use logical CPUs instead of physical by default #2391
Conversation
Some reasons to prefer logical count as the default: - Chips reporting many logical CPUs vs physical, such as via hyperthreading, probably know better than us about the workload the CPUs can handle. - The logical count (`num_cpus::get()`) takes into consideration schedular affinity, and cgroups CPU quota, in case the user wants to limit the amount of CPUs a process can use.
Looks like this also closes #2269. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! freebsd build is just busted.
This is fantastic! So many hacks to set the thread pool size when I want to run with fewer cores can go away 🎉 |
@seanmonstar @jonhoo I had to look into this matter too, in the context of actix-web. In my specific case, the configuration with I believe that some amount of benchmarks should be the judge in this matter, because there is a possibility that the performance is degraded out of the box with this configuration. |
@Vagelis-Prokopiou I suspect that's because hyperthreading is generally bad for performance (at least in my experience). It's a tricky trade-off. What I'd really like for us to do is to respect cgroups/affinity, but ignore hyperthreading, but I don't know that that's feasible to implement 😅 |
@jonhoo I am not that aware of the internals in order to provide a good proposal. What I am proposing is: a) Some benchmarks by various people, in order to decide the best default option from the currently available options. b) If option |
Some reasons to prefer logical count as the default:
hyperthreading, probably know better than us about the workload the CPUs
can handle.
num_cpus::get()
) takes into considerationschedular affinity, and cgroups CPU quota, in case the user wants to
limit the amount of CPUs a process can use.
Closes #2269