4月 192013
 

登录被监控主机修改Apache配置文件

login as: root
 root@192.168.1.90's password:
 Last login: Thu Apr 18 14:42:33 2013 from 192.168.1.151
 [root@localhost ~]# vi /etc/httpd/conf/httpd.conf

开启

ExtendedStatus On

#<Location /server-status>
#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</Location>

Allow from 192.168.1.151

[root@localhost ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@localhost ~]#
apache-server-status-01

login as: root
root@192.168.1.91’s password:
Last login: Thu Apr 18 09:11:58 2013 from 192.168.1.151

使用Apache Bench测试工具对指定页面连续发送10万次请求

[root@mail ~]# ab -n 100000 http://192.168.1.90/faq.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.90 (be patient)
Completed 10000 requests
Completed 20000 requests
^C

Server Software:        Apache/2.2.15
Server Hostname:        192.168.1.90
Server Port:            80

Document Path:          /faq.php
Document Length:        9372 bytes

Concurrency Level:      1
Time taken for tests:   206.254 seconds
Complete requests:      23142
Failed requests:        0
Write errors:           0
Total transferred:      222834318 bytes
HTML transferred:       216886824 bytes
Requests per second:    112.20 [#/sec] (mean)
Time per request:       8.913 [ms] (mean)
Time per request:       8.913 [ms] (mean, across all concurrent requests)
Transfer rate:          1055.07 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     9    9   1.2      9     103
Waiting:        8    8   0.1      8      13
Total:          9    9   1.2      9     103

Percentage of the requests served within a certain time (ms)
50%      9
66%      9
75%      9
80%      9
90%      9
95%      9
98%      9
99%      9
100%    103 (longest request)
[root@mail ~]# ab -n 100000 http://192.168.1.90/faq.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.90 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests

Server Software:        Apache/2.2.15
Server Hostname:        192.168.1.90
Server Port:            80

Document Path:          /faq.php
Document Length:        9372 bytes

Concurrency Level:      1
Time taken for tests:   888.851 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      962900000 bytes
HTML transferred:       937200000 bytes
Requests per second:    112.50 [#/sec] (mean)
Time per request:       8.889 [ms] (mean)
Time per request:       8.889 [ms] (mean, across all concurrent requests)
Transfer rate:          1057.92 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       5
Processing:     9    9   0.5      9      44
Waiting:        8    8   0.2      8      39
Total:          9    9   0.5      9      44

Percentage of the requests served within a certain time (ms)
50%      9
66%      9
75%      9
80%      9
90%      9
95%      9
98%      9
99%      9
100%     44 (longest request)
[root@mail ~]#

http://IP/server-status?refresh=N
apache-server-status-02

 

apache-server-status-03

“_” 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

apache-server-status-04 apache-server-status-05

Srv    Child Server number – generation
PID    OS process ID
Acc    Number of accesses this connection / this child / this slot
M    Mode of operation
CPU    CPU usage, number of seconds
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