apache的server-status如何分析的技术说明

apache的server-status本来是个不错的东西,但是很多时候我认为没有图形化界面的东西其友好性就大打折扣,我还是喜欢方便而又简单的东西。

不少人都会看apache的server-status,并讲出一大堆优化的想法来。呵呵,不过我还没有这个水平,到处找资料才基本了解了server-status进行分析的方法和步骤,明白了server-status每一项代表的含义。

 

XML/HTML代码
  1.   
  2.   
  3. Apache Server Status for www.blogguy.cn   
  4. Server Version: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny8 with Suhosin-Patch    
  5. Server Built: Apr 19 2010 19:57:58    
  6.   
  7. --------------------------------------------------------------------------------   
  8.   
  9. Current Time: Monday, 19-Jul-2010 05:58:58 MSD    
  10. Restart Time: Monday, 19-Jul-2010 05:49:34 MSD    
  11. Parent Server Generation:    
  12. Server uptime: minutes 24 seconds    
  13. requests currently being processed, idle workers    
  14. _K_W._W_KK......................................................   
  15. ................................................................   
  16. ................................................................   
  17. ................................................................   
  18. Scoreboard Key:   
  19. "_" Waiting for Connection, "S" Starting up, "R" Reading Request,   
  20. "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,   
  21. "C" Closing connection, "L" Logging, "G" Gracefully finishing,   
  22. "I" Idle cleanup of worker, "." Open slot with no current process   
  23.   
  24. PID Key:   
  25.   
  26. 24279 in state:   20020 in state:   29820 in state:    
  27.    29821 in state:   7553 in state:   29830 in state:    
  28.    7560 in state:   20286 in state:   20255 in state: K   
  29.   
  30. --------------------------------------------------------------------------------   
  31.   
  32. To obtain full report with current status information you need to use the ExtendedStatus On directive.   
  33.   
  34.   
  35. --------------------------------------------------------------------------------   
  36.   
  37. Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny8 with Suhosin-Patch Server at www.blogguy.cn Port 80   
  38.     
  39.   

接下来一行一行的看

 首先访问地址是:http://IP:端口/server-status,这是基本格式,如果你要启用本页面的自动刷新功能,可以这样http://IP:端口/server-status?refresh=10,表示每10秒钟自动刷新本页面。

接下来的3行

Apache Server Status for 
Server Version: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny8 with Suhosin-Patch 
Server Built: Apr 19 2010 19:57:58

表示服务的配置地址,版本,安装日期等,不是重点略看一下。

接下来的是重点了

Current Time: Monday, 19-Jul-2010 05:58:58 MSD //表示blogguy.cn的服务器上的时间
Restart Time: Monday, 19-Jul-2010 05:49:34 MSD //上次重启时间
Parent Server Generation: 0 //关于这个选项,blogguy.cn几乎没有看到合理的中文解释,百度上也有很多人问,但是要么是没人回答要么是回答得模棱两可的,到底是什么没有讲清楚。这里我根据外国的文献自己翻译一个说法来,万一不准确欢迎拍砖探讨,Parent Server Generation是什么?大概是这样一个东西,apache在正常运行后,apache的父进程会重读配置文件,如果配置文件有改动那么就强制所有apache的子进程重启,Parent Server Generation就是记录这个重启次数的。
Server uptime: 9 minutes 24 seconds //apache的持续运行时间,blogguy.cn刚重启哈,才被卡死
5 requests currently being processed, 4 idle workers //当前任务运行状况,正在处理的请求是5个,空闲的活动是4个

 _K_W._W_KK......................................................
................................................................
................................................................
................................................................

的含义是:

     _:等待连结中。
     S:启动中。
     R: 正在读取要求。
    W:正在送出回应。
    K:处于保持联机的状态。
    D:正在查找 DNS。
    C:正在关闭连结。
    L:正在写入记录文件。
    G:进入正常结束程序中。
    I:处理闲置。
    .:尚无此程序。


PID Key:

24279 in state: _ ,   20020 in state: K ,   29820 in state: _ 
   29821 in state: W ,   7553 in state: _ ,   29830 in state: W 
   7560 in state: _ ,   20286 in state: K ,   20255 in state: K

描述的是每个活动的状态信息,前面的数字代表什么意思?我也没有搞清楚,可能是进程号?猜想

To obtain a full report with current status information you need to use the ExtendedStatus On directive.//如果你需要看到更加详细的服务器状态报告,你需要把相应的选项打开。意思是说,本来server-status还可以提供一些选项给你看的,可惜你没有打开,如果你打开你可以看到流量信息,cpu信息等。但是官方文档说这样会导致安全隐患。

vi /etc/apache2/apache2.conf

在文件中添加一句:ExtendedStatus On

/etc/init.d/apache2 restart 

重启然后再访问http://IP:端口/server-status,看看效果:

 

XML/HTML代码
  1.   
  2.   
  3. Apache Server Status for www.blogguy.cn   
  4. Server Version: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny8 with Suhosin-Patch    
  5. Server Built: Apr 19 2010 19:57:58    
  6.   
  7. --------------------------------------------------------------------------------   
  8.   
  9. Current Time: Monday, 19-Jul-2010 06:43:17 MSD    
  10. Restart Time: Monday, 19-Jul-2010 06:43:01 MSD    
  11. Parent Server Generation:    
  12. Server uptime: 15 seconds    
  13. Total accesses: 14 Total Traffic: 56 kB    
  14. CPU Usage: u.02 s0 cu0 cs0 .133% CPU load    
  15. .933 requests/sec 3822 B/second 4096 B/request    
  16. requests currently being processed, idle workers    
  17. _KKKK__WW.......................................................   
  18. ................................................................   
  19. ................................................................   
  20. ................................................................   
  21. Scoreboard Key:   
  22. "_" Waiting for Connection, "S" Starting up, "R" Reading Request,   
  23. "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,   
  24. "C" Closing connection, "L" Logging, "G" Gracefully finishing,   
  25. "I" Idle cleanup of worker, "." Open slot with no current process   
  26.   
  27. Srv PID Acc CPU SS Req Conn Child Slot Client VHost Request    
  28. 0-0 21825 0/3/3 0.00 6043 0.0 0.03 0.03 61.148.109.86 blogguy.cn GET /templates/default/logo.jpg HTTP/1.1    
  29. 1-0 21831 2/2/2 0.00 12 4.9 0.00 0.00 61.148.109.86 blogguy.cn GET /templates/default/img/utf8.jpg HTTP/1.1    
  30. 2-0 21858 1/1/1 0.00 12 0.6 0.00 0.00 61.148.109.86 blogguy.cn GET /templates/default/img/wap.gif HTTP/1.1    
  31. 3-0 21877 1/1/1 0.00 11 1.0 0.00 0.00 61.148.109.86 blogguy.cn GET /templates/default/img/rss.gif HTTP/1.1    
  32. 4-0 21878 1/1/1 0.00 11 0.6 0.00 0.00 61.148.109.86 blogguy.cn GET /include/seccode.php HTTP/1.1    
  33. 5-0 21882 0/1/1 0.01 52 0.0 0.00 0.00 66.249.68.236 blogguy.cn GET /archives-201235-53.html HTTP/1.1    
  34. 6-0 21884 0/1/1 0.01 61 0.0 0.01 0.01 220.181.7.131 blogguy.cn GET HTTP/1.1    
  35. 7-0 21885 4/4/4 0.00 5.5 0.01 0.01 210.13.219.42 blogguy.cn GET /server-status HTTP/1.1    
  36. 8-0 21886 0/0/0 0.00 392864518 0.0 0.00 0.00 61.156.219.185 blogguy.cn GET /attachments/date_200711/jimozaichangge.mp3 HTTP/1.1    
  37.   
  38.   
  39.   
  40. --------------------------------------------------------------------------------   
  41.   
  42. Srv Child Server number generation    
  43. PID OS process ID    
  44. Acc Number of accesses this connection this child this slot    
  45. Mode of operation    
  46. CPU CPU usage, number of seconds    
  47. SS Seconds since beginning of most recent request    
  48. Req Milliseconds required to process most recent request    
  49. Conn Kilobytes transferred this connection    
  50. Child Megabytes transferred this child    
  51. Slot Total megabytes transferred this slot    
  52.   
  53.   
  54.   
  55. --------------------------------------------------------------------------------   
  56.   
  57. Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny8 with Suhosin-Patch Server at www.blogguy.cn Port 80   
  58.     

是不是全面多了呢?

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值