Centos

命名被殺

  • April 16, 2012

每隔一段時間,我的伺服器就會殺死named。這將被記錄:

Apr 16 17:00:08 li127-203 kernel: Out of memory: Kill process 15723 (named) score 38 or sacrifice child
Apr 16 17:00:08 li127-203 kernel: Killed process 15723 (named) total-vm:92096kB, anon-rss:5492kB, filers:0kB

看起來我的記憶體不足了,但是為什麼總是將其命名為被殺死而不是其他程序?有什麼辦法可以防止這種情況發生嗎?

我在 Linode VPS 上執行 CentOS 6.2。

OOM殺手是一個善變的情婦。BIND 之所以成為目標,是因為它被 OOM 殺手的邏輯認為是最佳目標。連結頁面的程式碼註釋中對此進行了很好的解釋,但需要粘貼:

/*
* oom_badness - calculate a numeric value for how bad this task has been
* @p: task struct of which task we should calculate
* @p: current uptime in seconds
*
* The formula used is relatively simple and documented inline in the
* function. The main rationale is that we want to select a good task
* to kill when we run out of memory.
*
* Good in this context means that:
* 1) we lose the minimum amount of work done
* 2) we recover a large amount of memory
* 3) we don't kill anything innocent of eating tons of memory
* 4) we want to kill the minimum amount of processes (one)
* 5) we try to kill the process the user expects us to kill, this
*    algorithm has been meticulously tuned to meet the principle
*    of least surprise ... (be careful when you change it)
*/

但這只會告訴您為什麼它針對 BIND。解決方案可能不是“讓它瞄准其他東西”,因為其他任何占用大量記憶體的東西可能也很重要。解決方案更有可能是“不要觸發OOM殺手”。

您能否增加該系統可用的記憶體或交換空間,或減少其他程序使用的記憶體?這個系統上還執行著什麼?BIND 是配置為權威的還是遞歸的(這將允許您限制其高速記憶體記憶體的使用)?

引用自:https://serverfault.com/questions/380010