If I grab an iex shell in one of these containers I see that “schedulers online” == 3, the number of CPU shares allocated, as I would expect. I also see the straight “schedulers” value is 96, which I presume is the number of cores the server hosting this container has.
Is it ok that “schedulers online” and “schedulers” do not match? Is the idea that “schedulers” is the maximum the BEAM could use, but schedulers online is the maximum it will use?
Basically I just want to feel a little more certain on the topic. I think I know what’s going on based on the docs I’ve ready but I’d like to feel confident I’m understanding correctly, so I’m here to check my understanding
If you go look here there’s a healthy amount of detail (look for Schedulers:SchedulerOnline)
In the spirit of time, here is the verbiage :
+S Schedulers:SchedulerOnline
Sets the number of scheduler threads to create and scheduler threads to set online. The maximum for both values is 1024. If the Erlang runtime system is able to determine the number of logical processors configured and logical processors available, Schedulers defaults to logical processors configured, and SchedulersOnline defaults to logical processors available; otherwise the default values are 1. If the emulator detects that it is subject to a CPU quota, the default value for SchedulersOnline will be limited accordingly.
If Schedulers or SchedulersOnline is specified as a negative number, the value is subtracted from the default number of logical processors configured or logical processors available, respectively.
Specifying value 0 for Schedulers or SchedulersOnline resets the number of scheduler threads or scheduler threads online, respectively, to its default value.
I actually found this! But the question I was left with was maybe more about the mechanics, “SchedulersOnline” sounds like “number of schedulers online right now”, so I found myself wondering if it can change over time.
Is there a situation where SchedulersOnline could increase for some reason (outside a literal config change)? Or is “SchedulersOnline” saying “here’s the number of schedulers, this number isn’t going to change unless you make it change”?
That is correct. The initialization of schedulers (cpu, io, both dirty and non dirty, etc.) and run queues is done at boot in the initialization of the emulator, after which it is on you to increase (and decrease) as needed.
Sorry, don’t have time right now to annotate, but if I do find some time later I will (no promises though)
It would also be fantastic to hear from members from the OTP team on any minor details related to all this and whether a documentation improvement could be made per commentary.