免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1207 | 回复: 0
打印 上一主题 下一主题

Solaris 性能监控命令 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-05-26 23:21 |只看该作者 |倒序浏览

Solaris 性能监控命令
1. cpu负荷
# sar 10 20
SunOS testpxn1 5.8 Generic_108528-19 sun4u    12/15/03
14:58:20    %usr    %sys    %wio   %idle
14:58:30      15       6       0      79
14:58:40      21       8       0      70
14:58:50      16       3       1      80
14:59:00      13       2       0      85
14:59:10      18       4       0      77
Average       17       5       0      78
示例中的sar命令每隔10秒钟给出一个cpu使用的统计,总共20次;最后,sar会给出一个平均值。

2. 内存管理
# vmstat 10 5
procs     memory            page            disk          faults      cpu
r b w   swap  free  re  mf  pi  po fr de sr s6 sd sd --   in   sy   cs us sy id
0 0 0 5934104 2377296 106 541 11 56 12 0 0 0  3  0  0  398 2556 2943 14  5 81
0 0 0 5835768 2271872 53 289 0 0  0  0  0  0  2  0  0  553 5679 3250 30  4 66
0 0 0 5835040 2271288 64 332 0 3  3  0  0  0  6  0  0  483 6243 3245 16  4 80
1 0 0 5832112 2263576 395 2105 0 0 0 0  0  0 16  0  0  918 11735 3735 60 13 27
1 0 0 5833280 2252656 26 181 0 0  0  0  0  0  9  0  0  898 8321 4241 61  6 33
        示例中的vmstat命令每隔10秒钟给出一个内存使用状况的统计,总共5次, free列表示的是空闲的内存。内存占有率过高会降低系统性能。
3. I/O管理

             iostat反映了终端、磁盘I/O情况和CPU活动。输出结果的第一行是从系统启动到现在为止的这段时间的结果,接下去的每一行是interval时间段内的结果。Kernel里有一组计数器用来跟踪这些值。
             iostat的默认参数是tdc(terminal,  disk, and CPU)。如果任何其他的选项被指定,这个默认参数将被完全替代,例如,iostat -d将只反映磁盘的统计结果。
        基本语法: iostat     interval  count

option - 让你指定所需信息的设备,像磁盘、cpu或者终端(-d , -c , -t  or -tdc ) 。x 选项给出了完整的统计结果(gives the extended  

statistic)。

interval -  在两个samples之间的时间(秒)。

count  - 就是需要统计几次

例子:

$ iostat -xtc 5 2
                          extended disk statistics       tty         cpu
     disk r/s  w/s Kr/s Kw/s wait actv svc_t  %w  %b  tin tout us sy wt id
     sd0   2.6 3.0 20.7 22.7 0.1  0.2  59.2   6   19   0   84  3  85 11 0
     sd1   4.2 1.0 33.5  8.0 0.0  0.2  47.2   2   23
     sd2   0.0 0.0  0.0  0.0 0.0  0.0   0.0   0    0
     sd3  10.2 1.6 51.4 12.8 0.1  0.3  31.2   3   31
    The fields have the following meanings:

      disk    name of the disk
      r/s     reads per second
      w/s     writes per second
      Kr/s    kilobytes read per second
      Kw/s    kilobytes written per second
      wait    average number of transactions waiting for service (Q length)
      actv    average number of transactions  actively   
              being serviced (removed  from  the
        queue but not yet
              completed)
      %w      percent of time there are transactions  waiting
              for service (queue non-empty)
      %b      percent of time the disk is busy  (transactions
                  in progress)
  
  Results and Solutions:
           从iostat输出结果中需要注意的值:

Reads/writes  per second (r/s , w/s)  
Percentage busy (%b)  
Service time (svc_t)  

如果磁盘显示长时间的高reads/writes,并且磁盘的percentage busy (%b)也远大于5%,同时average service time  (svc_t)也远大于30  

milliseconds,这以下的措施需要被执行:
1.)调整应用,令其使用磁盘i/o更加有效率,可以通过修改磁盘队列、使用应用服务器的cache  

2.)将文件系统分布到2个或多个磁盘上,并使用volume manager/disksuite的条带化特点

3.) 增加系统参数值,如inode cache  , ufs_ninode。Increase the system parameter values for  inode cache  , ufs_ninode ,  which  

is  Number of inodes to be held in memory. Inodes are cached globally (for UFS), not on a per-file system basis   

4.) 将文件系统移到更快的磁盘/控制器,或者用更好的设备来代替
4.网络性能

#netstat -i

Name  Mtu  Net/Dest  Address  Ipkts  Ierrs  Opkts  Oerrs  Collis  Queue   
lo0  8232  loopback  localhost  77814  0  77814  0  0  0   
hme0  1500  server1  server1  10658566  3  4832511  0  279257  0   

这个选项用于诊断网络问题,
Values to look at:  

Collisions (Collis)  
Output packets (Opkts)  
Input errors (Ierrs)  
Input packets (Ipkts)  
The above values will give information to workout  

i.  Network collision rate(网络冲突率)如下 :  

Network collision rate = Output collision counts / Output packets  

  网络冲突率大于10%就显示,网络负载过大、网络配置不正确、硬件问题  

ii.  Input packet error rate(进入包错误率)如下 :

Input Packet Error Rate = Ierrs / Ipkts.  

如果input error rate高(ver 0.25 percent),这个主机就正在丢包。hub/switch 连线就需要被检查是否存在潜在的问题。

C.  Network socket &  TCP Cconnection state
netstat给出了关于网络socket和tcp state的重要信息。只是非常有用的,在寻找开放、关闭和等待网络tcp连接。
netstat返回如下的网络状态 :
     CLOSED               ----  Closed.  The socket  is  not  being used.
     LISTEN                 ----  Listening for incoming connections.
     SYN_SENT           ----  Actively trying to  establish  connection.
     SYN_RECEIVED  ---- Initial synchronization of the connection under way.
     ESTABLISHED     ----  Connection has been established.
     CLOSE_WAIT      ----  Remote shut down; waiting  for  the socket to close.
     FIN_WAIT_1        ----  Socket closed; shutting  down  connection.
     CLOSING             ----  Closed,   then   remote   shutdown; awaiting acknowledgement.
     LAST_ACK          ----   Remote  shut  down,  then   closed ;awaiting acknowledgement.
     FIN_WAIT_2        ----  Socket closed; waiting for shutdown from remote.
     TIME_WAIT         ----  Wait after close for  remote  shutdown retransmission.

5.以 cpu顺序或内存顺序排列

prstat缺省以CPU利用率排序
prstat -s size以内存使用排序

-s key
           Sort output lines (that is, processes, lwps, or users)
           by  key  in descending order. Only one key can be used
           as an argument.

           There are five possible key values:

           cpu   Sort by process CPU usage. This is the default.

           time  Sort by process execution time.

           size  Sort by size of process image.

           rss   Sort by resident set size.

           pri   Sort by process priority.

6.Top工具


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/832/showart_118749.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP