Reputation: 15216
I want to limit pool size by amount of CPUs. How can I know amount of cores in the CPU for elixir?
Upvotes: 7
Views: 2024
Reputation: 84190
You can use System.schedulers_online/0 to get the number of available schedulers. This defaults to the number of cores.
This can be configured on boot with the +S
flag http://erlang.org/doc/man/erl.html#+S
If you really need the number of cores then you can use:
:erlang.system_info(:logical_processors_available)
You can see this option (and many others) on http://www1.erlang.org/doc/man/erlang.html#system_info-1
Upvotes: 11