昨日、wrk2を使ってパフォーマンステストをし可視化してみる。という記事を書きました。
いざ API Gateway + Lambdaで作成したサーバレス環境に対して負荷をかけようとしたところいっこうにつながらない...
四苦八苦してましたが、わざわざ解決するくらいなら信頼と実績のApache Benchを使ったほうが早いので負荷テストをします。
用意したもの
- docker
- Apache Bench
- https://hub.docker.com/r/jordi/ab/を用意してくれた偉大な有志に感謝
docker-composeの環境は下記に簡単なもの用意しました。
https://github.com/RyujiKawazoe/apachebench_study
使ってみる
起動
docker-compose run apachebench
負荷をかけてみる
ab -e hogehoge.csv -n 10 -c 1 -t 15 'https://fugafuga.com/'
結果が得られる
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking fugafuga.com (be patient)
Finished 18 requests
Server Software:
Server Hostname: fugafuga.com
Server Port: 443
SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128
TLS Server Name: fugafuga.com
Document Path:
Document Length: 12400 bytes
Concurrency Level: 1
Time taken for tests: 15.772 seconds
Complete requests: 18
Failed requests: 0
Total transferred: 232092 bytes
HTML transferred: 223200 bytes
Requests per second: 1.14 [#/sec] (mean)
Time per request: 876.247 [ms] (mean)
Time per request: 876.247 [ms] (mean, across all concurrent requests)
Transfer rate: 14.37 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 55 66 11.0 64 90
Processing: 608 810 182.5 763 1380
Waiting: 607 809 182.5 763 1380
Total: 694 876 180.5 824 1449
Percentage of the requests served within a certain time (ms)
50% 824
66% 859
75% 906
80% 952
90% 1127
95% 1449
98% 1449
99% 1449
100% 1449 (longest request)