[Erlang危机](5.1.3)进程

原创文章,转载请注明出处:server非业余研究http://blog.csdn.net/erlib 作者Sunface
联系邮箱:cto@188.com


Processes

Trying to get a global view of processes is helpful when trying to assess how much work is being done in the VM in terms of tasks. A general good practice in Erlang is to use processes for truly concurrent activities — on web servers, you will usually get one process per request or connection, and on stateful systems, you may add one process per-user — and therefore the number of processes on a node can be used as a metric for load.
 Most tools mentioned in section 5.1 will track them in one way or another, but if the process count needs to be done manually, calling the following expression is enough:

 查看全局进程数对了解VM的工作及负载情况是很有帮助的。一个良好的Erlang实践就是为每个并发的活动都派生出一个进程来处理——对于webserver,你常常会为每个请求或连接创建一个进程,而且,在有状态系统中。你可能会为每个用户都创建一个进程来进行管理,因此能够把节点上的总进程数做为负载情况的当中一个指标。
 章节5.1中提到的大部分工具都能以各种的方式来追踪它们。但假设手动获取系统进程数目。你仅仅须要使用以下这个函数就足够了:

--------------------------------------------
1> length(processes()).
56535
-------------------------------------------
 Tracking this value over time can be extremely helpful to try and characterize load or detect process leaks, along with other metrics you may have around.

 全程追踪这个指标对诊断系统负载及检測进程泄漏都是很实用的,当然也能够结合其他指标来一起诊断。
原文地址:https://www.cnblogs.com/jzssuanfa/p/6756636.html