- 論壇徽章:
- 0
|
20可用積分
環(huán)境:
vmware5.5 centos 5.2 Apache/2.2.10
由于是實驗環(huán)境,無應用,只有一個index.html
疑問1:使用了limitipconn_module來限制同一IP的并發(fā)連接,設置如下:
ExtendedStatus On
<IfModule limitipconn_module>
<Location />
MaxConnPerIP 3
NoIPLimit image/*
</Location>
</IfModule>
使用迅雷測試下載一個電影文件,默認的5個線程中只有3個線程在讀取數(shù)據(jù),經(jīng)多次測試無誤。這應該能說明上述的設置上有效的吧?
能不能用ab來測試同一IP的并發(fā)連接數(shù)呢?下面是我的設想,不知道科學與否,還請指正:
在上述設置下,同一IP的最大并發(fā)連接數(shù)為3,我若使用如下指令:ab -n 50 -c 10 127.0.0.1/index.html,每次并發(fā)量為10,則是不是應該有7個連接被拒絕呢?得到如下結果:
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 127.0.0.1 (be patient).....done
Server Software: Apache
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 10
Time taken for tests: 0.103 seconds
Complete requests: 50
Failed requests: 35
(Connect: 0, Receive: 0, Length: 35, Exceptions: 0)
Write errors: 0
Non-2xx responses: 35
Total transferred: 26384 bytes
HTML transferred: 16734 bytes
Requests per second: 487.28 [#/sec] (mean)
Time per request: 20.522 [ms] (mean)
Time per request: 2.052 [ms] (mean, across all concurrent requests)
Transfer rate: 251.10 [Kbytes/sec] received
若依據(jù)上述結果,則access_log中會有連接三個200和連續(xù)七個503的記錄。
上述ab測試是基于這種測試方法正確的假設之上的,事實上我在后來的測試過程中也多次出現(xiàn)過以上的結果,但每次測試的結果并不完全一樣,有時候被拒的包會較多,有時候較少,還會如下結果出現(xiàn):
Server Software: Apache
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 10
Time taken for tests: 0.113 seconds
Complete requests: 50
Failed requests: 0
Write errors: 0
Total transferred: 14000 bytes
HTML transferred: 2200 bytes
Requests per second: 442.83 [#/sec] (mean)
Time per request: 22.582 [ms] (mean)
Time per request: 2.258 [ms] (mean, across all concurrent requests)
Transfer rate: 121.09 [Kbytes/sec] received
根據(jù)以上情況,我的疑問是:
a、以我上述的方法測試同一IP最大并發(fā)連接數(shù)的方法是否科學?為什么?
b、ab測試的結果為什么會出現(xiàn)這種不穩(wěn)定的情況?
疑問2:關于prefork模式下最大并發(fā)數(shù)的問題:
關閉limitipconn_module,MPM配置如下:
<IfModule mpm_prefork_module>
StartServers 8
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
在此配置下,apache的最大并發(fā)數(shù)應該為150吧?那么我用ab或webbench測試151的并發(fā)正常來說是不是應該會報錯呢?但測試結果卻不是如此:
[root@centos ~]# ab -n 300 -c 151 http://127.0.0.1/index.html
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 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Finished 300 requests
Server Software: Apache
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 151
Time taken for tests: 0.404 seconds
Complete requests: 300
Failed requests: 0
Write errors: 0
Total transferred: 84000 bytes
HTML transferred: 13200 bytes
Requests per second: 743.47 [#/sec] (mean)
Time per request: 203.102 [ms] (mean)
Time per request: 1.345 [ms] (mean, across all concurrent requests)
Transfer rate: 203.29 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 29 28.3 11 92
Processing: 33 123 50.4 134 304
Waiting: 18 119 51.0 130 302
Total: 46 153 60.5 147 393
Percentage of the requests served within a certain time (ms)
50% 147
66% 154
75% 159
80% 171
90% 215
95% 236
98% 389
99% 392
100% 393 (longest request)
[root@centos ~]# ab -n 700 -c 257 http://127.0.0.1/index.html
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 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
Finished 700 requests
Server Software: Apache
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 257
Time taken for tests: 1.308 seconds
Complete requests: 700
Failed requests: 0
Write errors: 0
Total transferred: 196560 bytes
HTML transferred: 30888 bytes
Requests per second: 535.05 [#/sec] (mean)
Time per request: 480.330 [ms] (mean)
Time per request: 1.869 [ms] (mean, across all concurrent requests)
Transfer rate: 146.72 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 22 28.6 8 105
Processing: 33 292 375.7 144 1198
Waiting: 23 288 377.4 140 1197
Total: 36 314 400.9 150 1303
Percentage of the requests served within a certain time (ms)
50% 150
66% 155
75% 160
80% 177
90% 1218
95% 1260
98% 1286
99% 1295
100% 1303 (longest request)
[root@centos ~]# webbench -c 257 -t 10 http://127.0.0.1/index.html
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://127.0.0.1/index.html
257 clients, running 10 sec.
Speed=85380 pages/min, 398412 bytes/sec.
Requests: 14230 susceed, 0 failed.
根據(jù)上述情況的疑問如下:
a、 根據(jù)上述配置,正常情況下最大并發(fā)是150,是不是這樣?若不是,為什么?
b、ab或webbench能不能用來測試apache的最大并發(fā)數(shù),數(shù)據(jù)是否準確?我的使用方法是否有誤?
多謝! |
|