在Apache的调优过程中,可以通过查看Apache提供的server-status(状态报告)来验证当前所设置数值是否合理,在httpd.conf文件中做如下设置来打开:
#加载mod_status模块,linux环境下如果没有该模块需要加上参数--enable-module=so重新编译
LoadModule status_module modules/mod_status.so #设置访问地址
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
#如果限制某个IP访问则设置为Allow from 192.168.1.1
Allow from all
</Location> ExtendedStatus On
接下来就可以通过url访问到server-status了,http://ip地址/server-status,这是基本格式,如果你要启用本页面的自动刷新功能,可以这样http://ip地址/server-status?refresh=10,表示每10秒钟自动刷新本页面。接下来介绍下server-status,了解server-status每一项代表的含义。先贴一段本地的访问内容:
Apache Server Status for localhost Server Version: Apache/2.2.25 (Win32) DAV/2 mod_ssl/2.2.25 OpenSSL/0.9.8y
Server Built: Jul 10 2013 01:52:12
-------------------------------------------------------------------------
Current Time: Friday, 27-Mar-2015 10:28:52 Öйú±ê׼ʱ¼ä
Restart Time: Friday, 27-Mar-2015 09:17:50 Öйú±ê׼ʱ¼ä
Parent Server Generation: 6
Server uptime: 1 hour 11 minutes 1 second
Total accesses: 1197 - Total Traffic: 6.7 MB
.281 requests/sec - 1658 B/second - 5.8 kB/request
1 requests currently being processed, 149 idle workers
________________________________________________________________
_______________________________________________W________________
______________________..........................................
................................................................
................................................................
................................................................
................................................................
Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process Srv PID Acc M SS Req Conn Child Slot Client VHost Request
0-6 6880 0/0/839 _ 468 1 0.0 0.00 4.69 127.0.0.1 zhujg-PC.com.cn GET /server-status?refresh=2 HTTP/1.1
0-6 6880 33/336/336 W 0 0 202.1 1.96 1.96 127.0.0.1 zhujg-PC.com.cn GET /server-status HTTP/1.1
0-6 6880 0/0/1 _ 468 0 0.0 0.00 0.00 172.16.2.146 zhujg-PC.com.cn GET /cas?service=http://172.16.2.146/dms/index.jsp HTTP/1.1
0-6 6880 0/0/2 _ 468 4 0.0 0.00 0.01 172.16.2.146 zhujg-PC.com.cn NULL
0-6 6880 0/0/2 _ 468 4747 0.0 0.00 0.00 172.16.2.146 zhujg-PC.com.cn NULL
0-6 6880 0/0/4 _ 468 4 0.0 0.00 0.05 172.16.2.146 zhujg-PC.com.cn NULL
0-6 6880 0/0/3 _ 468 3 0.0 0.00 0.00 172.16.2.146 zhujg-PC.com.cn NULL
0-6 6880 0/0/3 _ 468 5 0.0 0.00 0.01 172.16.2.146 zhujg-PC.com.cn NULL
0-6 6880 0/0/7 _ 23 2 0.0 0.00 0.02 172.16.2.146 zhujg-PC.com.cn NULL
Srv Child Server number - generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot
SSL/TLS Session Cache Status:
前面三行,表示服务的配置地址,版本,安装日期等
Apache Server Status for localhost
Server Version: Apache/2.2.25 (Win32) DAV/2 mod_ssl/2.2.25 OpenSSL/0.9.8y
Server Built: Jul 10 2013 01:52:12 重点:
Current Time: Friday, 27-Mar-2015 10:28:52 Öйú±ê׼ʱ¼ä //表示服务器上的时间
Restart Time: Friday, 27-Mar-2015 09:17:50 Öйú±ê׼ʱ¼ä //上次重启时间
Parent Server Generation: 6 //apache在正常运行后,apache的父进程会重读配置文件,如果配置文件有改动那么就强制所有apache的子进程重启,Parent Server Generation就是记录这个重启次数的。
Server uptime: 1 hour 11 minutes 1 second //apache的持续运行时间
Total accesses: 1197 - Total Traffic: 6.7 MB
.281 requests/sec - 1658 B/second - 5.8 kB/request
1 requests currently being processed, 149 idle workers //当前任务运行状况,正在处理的请求是1个,空闲的活动是149个
________________________________________________________________
_______________________________________________W________________
______________________..........................................
................................................................
................................................................
_:等待连结中。
S:启动中。
R: 正在读取要求。
W:正在送出回应。
K:处于保持联机的状态。
D:正在查找 DNS。
C:正在关闭连结。
L:正在写入记录文件。
G:进入正常结束程序中。
I:处理闲置。
.:尚无此程序。
如果你需要看到更加详细的服务器状态报告,你需要把相应的选项打开,比如可以看到流量信息,cpu信息等。但是官方文档说这样会导致安全隐患
ExtendedStatus On