Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit the number of cores used by the Erlang VM (BEAM)?

I'm running experiments on a node with 2 x Quad-Core Xeon E5520 2.2GHz, 24.0GB RAM, and Erlang R15B02 (SMP enabled). I wonder if I can limit the number of cores used by the Erlang VM so that I can temporarily disable some cores and increase the number step by step in order to test scalability.

I don't have root access on this node. So I'm expecting some method which is either by specifying parameters to erl or by Erlang code.

like image 593
Xiao Jia Avatar asked Nov 11 '12 11:11

Xiao Jia


1 Answers

You can limit the number of cores Erlang uses via the +S option to erl, which allows you to set the number of scheduler kernel threads Erlang creates. See the erl man page for more details.

Note that Erlang linked-in port drivers and native implemented functions (NIFs) can both create their own threads and thus affect how many cores an Erlang process will use independently of the threads specified via the +S option, though none of the standard drivers or NIFs do this. Also the +A option to erl creates a pool of asynchronous threads for use by drivers that could also affect the number of cores used, and by default the async thread pool has 10 threads (it was empty by default prior to Erlang/OTP version R16B).

like image 133
Steve Vinoski Avatar answered Sep 27 '22 23:09

Steve Vinoski