[Erlang危機](5.1.3)進程,erlang5.1.3

來源:互聯網
上載者:User

[Erlang危機](5.1.3)進程,erlang5.1.3
原創文章,轉載請註明出處:伺服器非業餘研究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實踐就是為每一個並發的活動都派生出一個進程來處理——對於web伺服器,你經常會為每一個請求或串連建立一個進程,並且,在有狀態系統中,你可能會為每一個使用者都建立一個進程來進行管理,因此可以把節點上的總進程數做為負載情況的其中一個指標。
 章節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.

 全程追蹤這個指標對診斷系統負載及檢測進程泄漏都是非常有用的,當然也可以結合其它指標來一起診斷。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.