???????????????????? -c ?? -n ??????????. ????:
??????cmd?????? ???′???
????cd C:Apache2.2in
????ab -n 1000 -c 100 http://zf.guqin.com/index/index
????????????????100??????????1000??index.php????????????????????????
This is ApacheBench?? Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss?? Zeus Technology Ltd?? http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation?? http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests
Server Software:        Apache/2.2.8
//??apache ?汾2.2.8
Server Hostname:        zf.guqin.com
//????????????
Server Port:            80
//?????????
Document Path:          /index.php
//???????????
Document Length:        1018 bytes
//?????С
Concurrency Level:      1000
//??????
Time taken for tests:   8.188731 seconds
//????????????????
Complete requests:      1000
//????????????
Failed requests:        0
//????????????
Write errors:           0
Total transferred:      1361581 bytes
//?????????е????紫????
HTML transferred:       1055666 bytes
//?????????е?HTML?????????
Requests per second:    122.12 [#/sec] (mean)
//?????????????????? LR?е?????????????????????е? mean??????????????
Time per request:       8188.731 [ms] (mean)
//??????????????????? LR?е???????????????????????е? mean??????????????
Time per request:       8.189 [ms] (mean?? across all concurrent requests)
//??????????????????????
Transfer rate:          162.30 [Kbytes/sec] received
//????????????????????????????????????????????????????????????????
Connection Times (ms)
min mean[+/-sd] median   max
Connect:        4 646 1078.7     89    3291
Processing:   165 992 493.1    938    4712
Waiting:      118 934 480.6    882    4554
Total:        813 1638 1338.9   1093    7785
//?????????????????????????????????????????
Percentage of the requests served within a certain time (ms)
50%   1093
66%   1247
75%   1373
80%   1493
90%   4061
95%   4398
98%   5608
99%   7368
   7785 (longest request)
????//????????????????????????????????????????????????????????50?????????????С??1093 ????60?? ???????????С??1247 ?????????????С??7785 ????
??????????????????cpu????????????????????????????????????????????????????????????????Time per request????????????Time per request?????????????????
????window??????? p?????????
????ab.exe -n 100 -c 10  -p "D:/post.txt" -T "application/x-www-form-urlencoded" "http://localhost/test/index.php"
????post.txt???????
????myname=xiaoming&sex=1&age=10
????index.php????
????<?php
????file_put_contents('request.txt'??implode('####'??$_REQUEST));
??????????
????request.txt???????  ??? request.txt??index.php???
????xiaoming####1####10
????window??????? A?????????
????ab.exe -A myname:mypassword -n 100 -c 10   "http://localhost/test/index.php"
????PHP????????
????http://www.php100.com/manual/php/features.http-auth.html
????index.php????
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
$str = "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
$str .="<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
file_put_contents('request.txt'??$str);
}
????request.txt?????? ?????index.php??????
????<p>Hello myname.</p><p>You entered mypassword as your password.</p>