ab is a tool for benchmarking your Apache Hypertext
Transfer Protocol (HTTP) server. It is designed to give you an
impression of how your current Apache installation performs. This
especially shows you how many requests per second your Apache
installation is capable of serving.
jyshen@JYSHEN-WORKPC:~$ ab -n 100000 -c 1000 http://localhost:8080/ This is ApacheBench, Version 2.3 <$Revision: 1807734 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Server Software: Server Hostname: localhost Server Port: 8080
Document Path: / Document Length: 0 bytes
Concurrency Level: 1000 Time taken for tests: 15.595 seconds Complete requests: 100000 Failed requests: 0 Total transferred: 1300000 bytes HTML transferred: 0 bytes Requests per second: 6412.45 [#/sec] (mean) Time per request: 155.947 [ms] (mean) Time per request: 0.156 [ms] (mean, across all concurrent requests) Transfer rate: 81.41 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 33 78 20.6 78 143 Processing: 29 77 20.8 77 147 Waiting: 4 45 16.8 41 146 Total: 72 155 7.7 154 195
Percentage of the requests served within a certain time (ms) 50% 154 66% 155 75% 156 80% 156 90% 163 95% 169 98% 173 99% 184 100% 195 (longest request)
测得结果平均每秒能处理6412个请求。
多次测试能稳定在6000以上。
测试中观察内存和CPU消耗无异常情况。
其他影响因素:实验过程中,Windows Defender的Antimalware Service
Executable进程的CPU使用率明显上升,约7~10%。
(base) sjy@h3c-UniServer-R5200-G3:~$ ab -n 100000 -c 1000 http://localhost:8080/ This is ApacheBench, Version 2.3 <$Revision: 1807734 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Server Software: Server Hostname: localhost Server Port: 8080
Document Path: / Document Length: 0 bytes
Concurrency Level: 1000 Time taken for tests: 4.753 seconds Complete requests: 100000 Failed requests: 0 Total transferred: 1300000 bytes HTML transferred: 0 bytes Requests per second: 21041.56 [#/sec] (mean) Time per request: 47.525 [ms] (mean) Time per request: 0.048 [ms] (mean, across all concurrent requests) Transfer rate: 267.13 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 7 24 63.7 20 1052 Processing: 6 23 6.1 24 49 Waiting: 5 17 5.1 16 44 Total: 21 47 64.3 46 1084
Percentage of the requests served within a certain time (ms) 50% 46 66% 47 75% 48 80% 49 90% 51 95% 53 98% 56 99% 62 100% 1084 (longest request)
jyshen@ubuntu:~$ ab -c 1000 -n 100000 http://127.0.0.1:8080/ This is ApacheBench, Version 2.3 <$Revision: 1706008 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Server Software: Server Hostname: 127.0.0.1 Server Port: 8080
Document Path: / Document Length: 152 bytes
Concurrency Level: 1000 Time taken for tests: 3.296 seconds Complete requests: 100000 Failed requests: 0 Total transferred: 21500000 bytes HTML transferred: 15200000 bytes Requests per second: 30338.50 [#/sec] (mean) Time per request: 32.961 [ms] (mean) Time per request: 0.033 [ms] (mean, across all concurrent requests) Transfer rate: 6369.90 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 16 63.0 13 1015 Processing: 3 17 5.1 16 56 Waiting: 3 13 4.9 11 55 Total: 6 33 63.5 31 1042
Percentage of the requests served within a certain time (ms) 50% 31 66% 32 75% 33 80% 34 90% 35 95% 36 98% 40 99% 44 100% 1042 (longest request)
# install webbench wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz tar -zxvf webbench-1.5.tar.gz cd webbench-1.5/ sudo make sudo make install