-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Thread count should default to *ONLINE* CPU count #1468
Comments
This seems like a good improvement to me. Have you considered making a PR to change it in the way you suggested? |
eakraly
added a commit
that referenced
this issue
May 27, 2024
The code used `get_system_number_of_cpus()` instead of `get_system_active_number_of_cpus()` to configure number of relay servers. That caused incorrect number to be used on virtualized systems. See #1468
@staticglobal could you please confirm if the PR I merged works for you? Thanks |
maddymeows
pushed a commit
to maddymeows/coturn
that referenced
this issue
Jun 2, 2024
The code used `get_system_number_of_cpus()` instead of `get_system_active_number_of_cpus()` to configure number of relay servers. That caused incorrect number to be used on virtualized systems. See coturn#1468
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background:
In
apputils.c
we haveget_system_number_of_cpus()
which returnssysconf(_SC_NPROCESSORS_CONF));
(number of "configured" processors) andget_system_active_number_of_cpus()
which returnssysconf(_SC_NPROCESSORS_ONLN);
(number of "online/available" processors)Then
mainrelay.c
setsturn_params.cpus
toget_system_number_of_cpus()
(capped at 128) and then also defaultsgeneral_relay_servers_number
to this value.Issue:
On most systems in most situations configured == online so the difference is meaningless. However, when running in some virtualized environments, the difference can be significant.
In one scenario when running under HyperV a VM configured for 2 CPUs, the hardware always reports a total of 240 total CPUs, with only the first 2 CPUs being online and the other 238 offline. Presumably this is how the host implements virtualized CPU hotplugging. From
dmesg
:And
getconf
:coturn
correctly logs both the total (capped) and enabled CPU counts...but then proceeds with setting up 128 worker threads despite the system only having 2 CPUs. I believe this behavior is incorrect and instead
turn_params.cpus
should be set fromget_system_active_number_of_cpus()
instead.The text was updated successfully, but these errors were encountered: