系统平均负载

什么是系统平均负载(Load average)?(What Does "Load Average" Mean?)

在Linux系统中,uptime、w、top等命令都会有系统平均负载load average的输出,那么什么是系统平均负载呢?
系统平均负载被定义为在特定时间间隔内运行队列中的平均进程树。如果一个进程满足以下条件则其就会位于运行队列中:
- 它没有在等待I/O操作的结果
- 它没有主动进入等待状态(也就是没有调用'wait')
- 没有被停止(例如:等待终止)
例如:
[root@www2 init.d]# uptime
7:51pm up 2 days, 5:43, 2 users, load average: 8.13, 5.90, 4.94
命令输出的最后内容表示在过去的1、5、15分钟内运行队列中的平均进程数量。
一般来说只要每个CPU的当前活动进程数不大于3那么系统的性能就是良好的,如果每个CPU的任务数大于5,那么就表示这台机器的性能有严重问题。对于上面的例子来说,假设系统有两个CPU,那么其每个CPU的当前任务数为:8.13/2=4.065。这表示该系统的性能是可以接受的。

What Does "Load Average" Mean?

The load average numbers give the average number of jobs in the run queue over the last 1, 5, and 15 minutes. (These three time periods may vary from one vendor's Unix system to another, but are usually 1, 5 and 15 minutes.) In other words, the n-minute load average is the number of processes competing for the attention of the CPU(s) at any moment, averaged over n minutes.
The load average plotted here is the 15-minute average. The lowest possible load average is zero, the highest unlimited, though we rarely see load averages exceeding 20, and even 10 is unusual. A load average of one or two is about typical.

平均负载的定义比较复杂,并且受到正在执行的进程的状态影响。通常,正在运行、等待 CPU 或等待 I/O 的每个进程都会使平均负载加 1。然后对这些图表进行计算并根据时间平均。

在单 CPU 的系统中,平均负载大于 1 则表示该 CPU 难以承受您所分配的负载类型。但是因为 UNIX 的多进程的本质,在您关注到该问题前,平均负载在长时间内(换句话说,对应于 15 分钟的图表)达到 2 通常是可以接受的。

在多 CPU(或多核)系统中,需要将平均负载除以 CPU 的个数。要确定计算机是否超负荷运行,请使用上述原则。
......
任何长时间的或未预料到的较高的值都可能表示存在问题,并且需要进行进一步的研究。如果这些数值较低,但系统却运行迟缓,那么可能表示存在交换空间的问题。


转自:http://hi.baidu.com/dekar/blog/item/dceb38013852a2e709fa9343.html

发布了20 篇原创文章 · 获赞 21 · 访问量 34万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章