其神若何,月射寒江。

操作系统监控(3)

上一篇 / 下一篇  2010-07-19 10:29:23 / 个人分类:性能测试

1.1   系统cpu情况

1.1.1  Cpu短缺判断 top

统计的是全部cpu的情况

 

 

1.1.2  Cpu短缺判断 vmstat

统计的是全部cpu的情况

特点:等待进程过多(大于4),空闲CPU太少(少于40

1.)如果在processes中运行的序列(process r)是连续的大于在系统中的CPU的个数表示系统现在运行比较慢,有多数的进程等待CPU.

 Procs.r >cpu个数,表示系统慢

2.)如果r的输出数大于系统中可用CPU个数的4倍的话,则系统面临着CPU短缺的问题,或者是CPU的速率过低,系统中有多数的进程在等待CPU,造成系统中进程运行过慢.

 Procs.r >*cpu个数,表示cpu短缺

3.)如果空闲时间(cpu id)持续为0并且系统时间(cpu sy)是用户时间的两倍(cpu us)系统则面临着CPU资源的短缺.

Cpu.id=0 && cpu.sy>cpu.us*2 cpu短缺 

 

 

bash-2.03# vmstat 2

 procs    memory           page           disk         faults     cpu

 rb w  swap free re mf pi po fr de sr s6 sd sd --  in  sy  csus sy id

 0 0 0 6093120 4373312 1 13 2 0 0 0 0 0 2 0 0 151 156 134 1 1 98

 0 0 0 5916512 4650168 0 3 0 0 0 0 0 0 2 0 0 148  59 126 0 0 100

 0 0 0 5916512 4650168 0 0 0 0 0 0 0 0 1 0 0 138  90 105 0 2 98

 0 0 0 5916512 4650168 0 0 0 0 0 0 0 0 0 0 0 183  95 146 0 0 99

 

1.1.3  Cpu短缺判断 mpstat

统计的是每个cpu的情况。注意有的cpu比较忙,有的比空闲的情况

查看各个cpu的空闲情况,idl

 

bash-2.03# mpstat 3

CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl

 0   6  0   8  246 145  84   0   2   0   0   73   1  0  0 99

 1   7  0  10    4   1  49   0   2   0   0   81   1  2  1 97

CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl

 0   2  0   2  245 144  95   0   0   0   0   37   0  0  0 100

 1   0  0   3    3   1  22   0   0   0   0   25   0  0  1 99

CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl

 0   0  0   1  255 153  95   0   1   0   0   34   0  0  0 100

 1   0  0   3    4   1  24   0   1   0   0   10   0  5  0 95

CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl

 0   0  0   3  248 147  90   0   1   0   0  108   0  0  1 99

 1   0  0   3    3   1  22   0   2   0   0  114   0  0  0 99

CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl

 0   0  0   1  238 136  82   0   1   0   0    1   0  0  0 100

 1   0  0   3    3   1  16   0   0   0   0   16   0  2  1 97

 

l        各个字段含义

minf:轻微故障

mjf:重要故障

xcal:CPU的交叉调用

intr:中断数

Ithr:线程中断数(不包括时钟中断)

csw:上下文切换数

icsw:强制的上下文切换次数

migr:线程的迁移数。

smtx:相互排他的span

srw: 读写锁的span

syscl:系统调用。

usr:用户的占用时间比率

sys:系统的占用时间比率

wt:系统的等待时间比率

idl:系统的空闲(发呆)时间比率

 

 

1.2   进程情况

1.2.1  打开文件

l        lunix

 

>>查看/proc/2206/fd打开的文件

 

/proc/2206/fd  

2206为进程号,在该目录下可以看到所有打开的文件链接

 

 

l        solaris

>>取得打开文件的详细信息

pfiles  pid  进程id打开的文件描述符列表

 

例如:

pfiles 2206

2206:  /opt/testtool/tools/jdk/bin/java -server -Xdebug -Xnoagent -Djava.comp

 Current rlimit: 1024 file descriptors

 ……

 18: S_IFSOCK mode:0666 dev:361,0 ino:31182 uid:0 gid:0 size:0

     O_RDWR

       SOCK_STREAM

       SO_SNDBUF(49152),SO_RCVBUF(49640),IP_NEXTHOP(0.0.193.232)

       sockname: AF_INET 172.19.66.56 port: 54375

       peername: AF_INET 172.19.148.247 port:8090

 

>>查看/proc/2206/fd打开的文件

 

/proc/2206/fd  

2206为进程号,在该目录下可以看到所有打开的文件链接

 

例如

bash-3.00# ls -l /proc/2206/fd  

total 1776

c---------  1 root    sys      13, 2 Jul 6 17:07 0

--w-------  1 testtool dba      357378 Jul 5 17:45 1

s---------  0 root    root          0 Jul 5 17:04 10

s---------  0 root    root          0 Jul 5 17:04 11

s---------  0 root    root          0 Jul 5 17:45 16

s---------  0 root    root          0 Jul 5 17:05 17

s---------  0 root    root          0 Jul 5 17:05 18

--w-------  1 testtool dba      357378 Jul 5 17:45 2

c---------  1 root    sys      13, 12 May 2 14:56 3

D---------  1 root    root          0 May 2 14:56 4

s---------  0 root    root          0 Jul 5 17:04 5

s---------  0 root    root          0 Jul 5 17:04 7

s---------  0 root    root          0 Jul 5 17:04 8

--w-------  1 testtool dba      155792 Jul 5 17:05 9

 

 

1.2.2  占用cpu

top

1.2.3  占用内存

top


TAG: vmstat

 

评分:0

我来说两句

xiaohanjiang

xiaohanjiang

River.liu又名小寒江。曾经从事多年JAVA软件开发工作,这几年一直从事软件测试工作。多年来,一直致力于软件工程、软件开发、软件测试方面的研究。不喜欢自称高手,不愿意自封资深;科学研究讲究的是务实、实践。真理、真知才是硬道理。茫茫海洋,我只希望我的每个理念能游弋于业界之间。我的思想能在你的脑海中徜徉。

日历

« 2024-04-24  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 39813
  • 日志数: 52
  • 建立时间: 2009-12-15
  • 更新时间: 2011-03-14

RSS订阅

Open Toolbar