限制erlang使用的内核数量 [英] limit the number of cores used by erlang

查看:161
本文介绍了限制erlang使用的内核数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用2 x四核Xeon E5520 2.2GHz,24.0GB RAM和Erlang R15B02(启用SMP)的节点上进行实验。我不知道是否可以限制Erlang VM使用的内核数量,以便我可以暂时禁用一些内核,并逐步增加数量,以便测试可扩展性。



我没有root访问此节点。所以我期望一些方法是通过指定参数 erl 或Erlang代码。

解决方案

您可以通过 + S 选项将Erlang使用的内核数量限制为 erl ,它允许您设置Erlang创建的调度程序内核线程的数量。有关详细信息,请参阅 erl手册页



请注意,Erlang 链接端口驱动程序本机实现的功能(NIF)都可以创建自己的线程,从而影响Erlang的内核数量过程将独立于通过 + S 选项指定的线程使用,尽管标准驱动程序或NIF都不执行此操作。另外, + A 选项到 erl 创建一个异步线程池,供驱动程序使用,也可能影响使用的内核,默认情况下,异步线程池有10个线程(Erlang / OTP版本R16B之前默认为空)。


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.

解决方案

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).

这篇关于限制erlang使用的内核数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆