Chinaunix

标题: 看下我top的输出,甚是迷惑 [打印本页]

作者: king_boss    时间: 2008-05-12 15:41
标题: 看下我top的输出,甚是迷惑
top - 15:31:51 up 149 days,  2:59,  2 users,  load average: 1.02, 1.12, 1.12
Tasks: 512 total,   2 running, 510 sleeping,   0 stopped,   0 zombie
Cpu(s):  24.2% user,   3.9% system,   0.0% nice,  71.9% idle
Mem:   2068932k total,  2013708k used,    55224k free,   138328k buffers
Swap:  2048152k total,    93156k used,  1954996k free,  1525328k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
1863 kkb       16   0  1552 1552 1300 R 99.9  0.1 141:49.18 HdHelpServer   
1865 kkb        9   0  1344 1344  824 S  3.3  0.1   3:25.41 top               
20646 kkb       15   0  1340 1340  832 R  0.7  0.1   0:00.72 top               
5483 kkb        9   0  4608 4488 4116 S  0.4  0.2  18:57.12 mkkclubui_str      

这里有一个HdHelpServer的进程CPU占用率一直(我的top刷新时间为默认的3秒)为99.9%, 但是上面的idle 确是71.9%
没感觉机器会慢,这个机器是机房的服务器,版本为suse 10 企业版。 平常我自家用笔记本上的FC6 ,只要用top一些类似与makewhatis的进程CPU占用率比较长时间
CPU占用率为99.9%机器一定会很热,而且响应速度很慢
这是为什么啊?   我一个同事的解释是“显示的问题”, 难道真是top的显示问题
????  
先谢过大家了
作者: walkerxk    时间: 2008-05-13 09:07
如果你的CPU是多核的,那么下面的99.9%就要除以一个N。负载很低,应该没有问题。
作者: linuxnextyear    时间: 2008-05-13 09:32
原帖由 walkerxk 于 2008-5-13 09:07 发表
如果你的CPU是多核的,那么下面的99.9%就要除以一个N。负载很低,应该没有问题。


借此帖问一下,我现在也有这种疑惑,我的问题是服务器的负载总是很高
服务器是4个双核cpu,提供apache服务
有的时候负载能到10以上,平时也在7-8左右,
请问系统负载有没有什么阈值什么的?我怎么知道负载多大系统就是有问题了???
作者: linuxnextyear    时间: 2008-05-13 13:58
没有人回答一下吗?
作者: todayhero    时间: 2008-05-13 16:16
标题: 回复 #4 linuxnextyear 的帖子
查看CPU个数.
cat /proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Xeon(TM) CPU 2.80GHz
stepping        : 4
cpu MHz         : 2793.471
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid xtpr
bogomips        : 5589.40

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Xeon(TM) CPU 2.80GHz
stepping        : 4
cpu MHz         : 2793.471
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid xtpr
bogomips        : 5585.88

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Xeon(TM) CPU 2.80GHz
stepping        : 4
cpu MHz         : 2793.471
cache size      : 1024 KB
physical id     : 3
siblings        : 2
core id         : 3
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid xtpr
bogomips        : 5586.16

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Xeon(TM) CPU 2.80GHz
stepping        : 4
cpu MHz         : 2793.471
cache size      : 1024 KB
physical id     : 3
siblings        : 2
core id         : 3
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid xtpr
bogomips        : 5586.12

这里是4颗CPU(实际是两颗双核CPU).但就是4,而不是2.
4颗CPU,就把CPU利用率看作400%,从而99.9%也就是占了1(1/4)颗CPU的利用.也就是25%,所以还有75%(3/4)的idle是很正常的

[ 本帖最后由 todayhero 于 2008-5-13 16:26 编辑 ]
作者: todayhero    时间: 2008-05-13 16:24
原帖由 linuxnextyear 于 2008-5-13 09:32 发表


借此帖问一下,我现在也有这种疑惑,我的问题是服务器的负载总是很高
服务器是4个双核cpu,提供apache服务
有的时候负载能到10以上,平时也在7-8左右,
请问系统负载有没有什么阈值什么的?我怎么知道负 ...



按你说的.你的CPU个数.就应该是8个.通过/proc/cpuinfo查看能得到的

负载到10.应该是使用vmstat 10 10命令查看得到
[root@u pdf_spider]# vmstat 1 10
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
10 0    508 666400  12784 539324    0    0     1     3    8     9  7  3 88  1
12  2    508 664928  12788 539580    0    0   136  1040 4144  2357 11  5 79  5

如果这样的话.你有8个CPU.同时可以处理8个任务.而这时有10个任务等待处理.一定是负载过大.如果总是保持在8以上的话.如果偶尔问题不是很严重.

看一下.APACHE并发数是不是真的很大.这样的服务器.我感觉.APACHE设置为KEEPALIVE ON KEEPALIVETIMEOUT 15的情况,能提供4000个并发数.

有兴趣.加我一起讨论一下.QQ 715509387
作者: linuxnextyear    时间: 2008-05-14 09:45
标题: 回复 #6 todayhero 的帖子
我确实只有4个cpu而不是8个。cat /proc/cpuinfo
用vmstat看到的是等待队列吧,我的等待队列基本是0,偶尔是1、2,所以,而且我的服务器并发很小

只是用top命令看到的load average很大,我说的平均7-8是top中的数据

楼上的,有msn吗?我上不了QQ
作者: todayhero    时间: 2008-05-14 11:17
原帖由 linuxnextyear 于 2008-5-14 09:45 发表
我确实只有4个cpu而不是8个。cat /proc/cpuinfo
用vmstat看到的是等待队列吧,我的等待队列基本是0,偶尔是1、2,所以,而且我的服务器并发很小

只是用top命令看到的load average很大,我说的平均7-8是top中 ...



load average的值除CPU个数.如果不大于5,主表示负载不大.不用担心.8/4=2.所以不用担心.性能问题

load average值过大.可能不是APACHE引起.你再看看其它服务进程吧!




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2