ApacheBench는 Apache HTTP Server에 포함되어 있습니다.
- -n : 총 요청 수
- -c : 동시 요청수
실전을 통해 알아보겠습니다.
1. 테스트에 사용된 test.jsp는 약 10초 수행되는 업무입니다.
-n5 : 총 5개 요청합니다.
$ ./ab -n5 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11209 bytes
Concurrency Level: 1
Time taken for tests: 50.347 seconds
Complete requests: 5
Failed requests: 2
(Connect: 0, Receive: 0, Length: 2, Exceptions: 0)
Write errors: 0
Total transferred: 56717 bytes
HTML transferred: 56042 bytes
Requests per second: 0.10 [#/sec] (mean)
Time per request: 10069.314 [ms] (mean)
Time per request: 10069.314 [ms] (mean, across all concurrent requests)
Transfer rate: 1.10 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 10003 10069 143.5 10007 10326
Waiting: 10003 10068 141.0 10007 10320
Total: 10003 10069 143.5 10007 10326
Percentage of the requests served within a certain time (ms)
50% 10007
66% 10007
75% 10007
80% 10326
90% 10326
95% 10326
98% 10326
99% 10326
100% 10326 (longest request)
-> 1개씩 5회 (총 5회, 약 50초) 요청됩니다.
-c2, -n5 : 총 5개 요청하는데 동시 요청 수가 2입니다. (2, 2, 1)
$ ./ab -c2 -n5 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11209 bytes
Concurrency Level: 2
Time taken for tests: 30.014 seconds
Complete requests: 5
Failed requests: 3
(Connect: 0, Receive: 0, Length: 3, Exceptions: 0)
Write errors: 0
Total transferred: 56708 bytes
HTML transferred: 56033 bytes
Requests per second: 0.17 [#/sec] (mean)
Time per request: 12005.446 [ms] (mean)
Time per request: 6002.723 [ms] (mean, across all concurrent requests)
Transfer rate: 1.85 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.1 0 3
Processing: 10003 10005 1.8 10005 10007
Waiting: 10003 10004 0.9 10004 10005
Total: 10003 10005 2.6 10005 10009
Percentage of the requests served within a certain time (ms)
50% 10004
66% 10007
75% 10007
80% 10009
90% 10009
95% 10009
98% 10009
99% 10009
100% 10009 (longest request)
-> 1개씩 10회 (총 10회) 요청됩니다.
이번에는 조금 더 올려보겠습니다.
-n10 : 총 10개 요청합니다.
$ ./ab -n10 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11205 bytes
Concurrency Level: 1
Time taken for tests: 100.030 seconds
Complete requests: 10
Failed requests: 6
(Connect: 0, Receive: 0, Length: 6, Exceptions: 0)
Write errors: 0
Total transferred: 113424 bytes
HTML transferred: 112074 bytes
Requests per second: 0.10 [#/sec] (mean)
Time per request: 10002.997 [ms] (mean)
Time per request: 10002.997 [ms] (mean, across all concurrent requests)
Transfer rate: 1.11 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 10003 10003 0.2 10003 10003
Waiting: 10001 10003 0.5 10003 10003
Total: 10003 10003 0.2 10003 10003
Percentage of the requests served within a certain time (ms)
50% 10003
66% 10003
75% 10003
80% 10003
90% 10003
95% 10003
98% 10003
99% 10003
100% 10003 (longest request)
-> 1개씩 10회 (총 10회, 약 100초) 요청됩니다.
이번에는 총 10개, 동시 2개입니다.
$ ./ab -c2 -n10 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11205 bytes
Concurrency Level: 2
Time taken for tests: 50.018 seconds
Complete requests: 10
Failed requests: 5
(Connect: 0, Receive: 0, Length: 5, Exceptions: 0)
Write errors: 0
Total transferred: 113421 bytes
HTML transferred: 112071 bytes
Requests per second: 0.20 [#/sec] (mean)
Time per request: 10003.565 [ms] (mean)
Time per request: 5001.782 [ms] (mean, across all concurrent requests)
Transfer rate: 2.21 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.5 0 2
Processing: 10002 10003 1.0 10003 10005
Waiting: 10002 10003 1.0 10003 10005
Total: 10002 10003 1.2 10003 10005
Percentage of the requests served within a certain time (ms)
50% 10003
66% 10004
75% 10004
80% 10005
90% 10005
95% 10005
98% 10005
99% 10005
100% 10005 (longest request)
-> 2개씩 5회 (총 10회, 약 50초) 요청됩니다.
이번에는 총 10개, 동시 3개입니다.
$ ./ab -c3 -n10 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11208 bytes
Concurrency Level: 3
Time taken for tests: 40.017 seconds
Complete requests: 10
Failed requests: 6
(Connect: 0, Receive: 0, Length: 6, Exceptions: 0)
Write errors: 0
Total transferred: 113424 bytes
HTML transferred: 112074 bytes
Requests per second: 0.25 [#/sec] (mean)
Time per request: 12005.046 [ms] (mean)
Time per request: 4001.682 [ms] (mean, across all concurrent requests)
Transfer rate: 2.77 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.8 0 2
Processing: 10003 10004 1.3 10004 10007
Waiting: 10002 10004 1.6 10004 10007
Total: 10003 10004 1.2 10004 10007
Percentage of the requests served within a certain time (ms)
50% 10004
66% 10005
75% 10005
80% 10005
90% 10007
95% 10007
98% 10007
99% 10007
100% 10007 (longest request)
-> 3회, 3회, 3회, 1회 요청됩니다. (약 40초)
이번에는 총 10개, 동시 4개입니다.
$ ./ab -c4 -n10 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11210 bytes
Concurrency Level: 4
Time taken for tests: 30.019 seconds
Complete requests: 10
Failed requests: 9
(Connect: 0, Receive: 0, Length: 9, Exceptions: 0)
Write errors: 0
Total transferred: 113421 bytes
HTML transferred: 112071 bytes
Requests per second: 0.33 [#/sec] (mean)
Time per request: 12007.434 [ms] (mean)
Time per request: 3001.859 [ms] (mean, across all concurrent requests)
Transfer rate: 3.69 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.3 0 3
Processing: 10004 10005 2.0 10006 10010
Waiting: 10002 10005 2.2 10005 10010
Total: 10004 10006 2.4 10006 10010
Percentage of the requests served within a certain time (ms)
50% 10006
66% 10008
75% 10008
80% 10008
90% 10010
95% 10010
98% 10010
99% 10010
100% 10010 (longest request)
-> 4회, 4회, 2회 요청됩니다. (약 30초)
2. 이어지는 테스트에 사용된 test.jsp는 수행시간이 매번 달라지는 업무입니다.
총 20개, 동시 5개.
$ ./ab -c5 -n20 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11450 bytes
Concurrency Level: 5
Time taken for tests: 61.406 seconds
Complete requests: 20
Failed requests: 19
(Connect: 0, Receive: 0, Length: 19, Exceptions: 0)
Write errors: 0
Total transferred: 224667 bytes
HTML transferred: 221967 bytes
Requests per second: 0.33 [#/sec] (mean)
Time per request: 15351.571 [ms] (mean)
Time per request: 3070.314 [ms] (mean, across all concurrent requests)
Transfer rate: 3.57 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 3.9 0 11
Processing: 7384 13799 3692.4 14003 23003
Waiting: 7383 13798 3692.4 14003 23003
Total: 7392 13801 3691.5 14003 23003
Percentage of the requests served within a certain time (ms)
50% 14003
66% 15392
75% 16003
80% 17003
90% 18003
95% 23003
98% 23003
99% 23003
100% 23003 (longest request)
총 40개, 동시 10개.
$ ./ab -c10 -n40 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11355 bytes
Concurrency Level: 10
Time taken for tests: 62.017 seconds
Complete requests: 40
Failed requests: 39
(Connect: 0, Receive: 0, Length: 39, Exceptions: 0)
Write errors: 0
Total transferred: 443925 bytes
HTML transferred: 438525 bytes
Requests per second: 0.64 [#/sec] (mean)
Time per request: 15504.301 [ms] (mean)
Time per request: 1550.430 [ms] (mean, across all concurrent requests)
Transfer rate: 6.99 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 2.0 0 7
Processing: 8003 14253 3264.0 14003 22003
Waiting: 8003 14252 3263.9 14002 22002
Total: 8003 14254 3264.2 14004 22004
Percentage of the requests served within a certain time (ms)
50% 14004
66% 15003
75% 17003
80% 18003
90% 19004
95% 20006
98% 22004
99% 22004
100% 22004 (longest request)
총 100개, 동시 20개.
$ ./ab -c20 -n100 http://127.0.0.1:8000/test.jsp
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: 8000
Document Path: /test.jsp
Document Length: 11594 bytes
Concurrency Level: 20
Time taken for tests: 78.256 seconds
Complete requests: 100
Failed requests: 98
(Connect: 0, Receive: 0, Length: 98, Exceptions: 0)
Write errors: 0
Total transferred: 1117708 bytes
HTML transferred: 1104208 bytes
Requests per second: 1.28 [#/sec] (mean)
Time per request: 15651.295 [ms] (mean)
Time per request: 782.565 [ms] (mean, across all concurrent requests)
Transfer rate: 13.95 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 4.2 0 14
Processing: 5006 14128 4285.9 14002 23222
Waiting: 5006 14128 4285.8 14002 23222
Total: 5006 14130 4286.1 14002 23235
Percentage of the requests served within a certain time (ms)
50% 14002
66% 16003
75% 17238
80% 19003
90% 20003
95% 22003
98% 23005
99% 23235
100% 23235 (longest request)
2. 발생 가능 오류
Benchmarking 127.0.0.1 (be patient)...apr_poll: The timeout specified has expired (70007)
- 2.4의 경우 -s
- 2.2의 경우 -t