Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know amount of cores in the CPU for elixir?

Tags:

erlang

elixir

I want to limit pool size by amount of CPUs. How can I know amount of cores in the CPU for elixir?

like image 882
asiniy Avatar asked Jan 06 '23 15:01

asiniy


1 Answers

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

like image 80
Gazler Avatar answered Jan 16 '23 08:01

Gazler