Help us understand the problem. What is going on with this article?

VPSで立てたwebサーバ(Apahce)をabでテスト

More than 5 years have passed since last update.

久しぶりabを使いたくなったのとVPS上にある仮想マシンにテストするとどれくらいパフォーマンスがでるのかをみたくなったので軽い気持ちでテスト。

環境

cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)

httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Jul 23 2014 14:48:00

ab -V
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

abコマンド

ab -n 1000 -c 10 http://hogehogehogehoge389/blog
※10人が同時接続で1000回リクエスト

This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking xx.xx.xx.xx (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
Completed 1000 requests
Finished 1000 requests

Server Software: Apache/2.4.6
Server Hostname: XX.XX.XX.XX
Server Port: 80

Document Path: /blog
Document Length: 233 bytes

Concurrency Level: 10
Time taken for tests: 1.200 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Non-2xx responses: 1000
Total transferred: 488000 bytes
HTML transferred: 233000 bytes
Requests per second: 833.03 #/sec
Time per request: 12.004 ms
Time per request: 1.200 ms
Transfer rate: 396.99 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 3 9.6 1 69
Processing: 1 8 16.8 3 71
Waiting: 0 6 14.0 2 69
Total: 3 11 18.9 4 72

Percentage of the requests served within a certain time (ms)
50% 4
66% 4
75% 4
80% 5
90% 64
95% 65
98% 65
99% 66
100% 72 (longest request)

エラーなしで、833.03RPSの性能がでることを確認

ついでに別窓を上げてCPUリソース状況などを確認してみる
vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 656284 0 221148 0 0 1 0 0 3 0 0 100 0 0
0 0 0 656268 0 221148 0 0 0 0 0 10 0 0 100 0 0
0 0 0 656268 0 221148 0 0 0 0 0 9 0 0 100 0 0
0 0 0 656268 0 221148 0 0 0 0 0 9 0 0 100 0 0

ちょっとみにくいけどid(idle)が100%で推移している
同じようにabをかけて様子をみると、

vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 656268 0 221148 0 0 0 0 0 6 0 0 100 0 0
0 0 0 656268 0 221148 0 0 0 0 0 0 0 0 100 0 0
0 0 0 654920 0 221148 0 0 0 0 0 5 4 9 87 0 0
0 0 0 654596 0 221216 0 0 0 0 0 0 3 8 89 0 0
0 0 0 655868 0 221240 0 0 0 0 0 0 0 1 99 0 0
0 0 0 655880 0 221240 0 0 0 0 0 0 0 0 100 0 0

idが減少して、us(usr)、sy(sys)でCPUリソースが消費されている

ab -n 100000 -c 10 http://hogehogehogehoge389/blog

調子にのってこれくらいでかけてみる

vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 653332 0 221368 0 0 0 0 0 2627 5 15 80 0 0

さらに調子にのって別プロセスで重ねがけ
(ctrl+z)で一時停止してbgでバックグラウンド実行して、
さらにab実行してみる

^Z
[1]+ Stopped ab -n 100000 -c 10 http://hogehogehogehoge389/blog

bg
[1]+ ab -n 100000 -c 10 http://hogehogehogehoge389/blog &

ab -n 100000 -c 10 http://hogehogehogehoge389/blog

vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 684316 0 233476 0 0 0 0 0 3411 6 14 80 0 0
2 0 0 684208 0 233576 0 0 0 0 0 3191 5 15 81 0 0
0 0 0 682896 0 233640 0 0 0 0 0 2274 5 15 80 0 0

どうやらさらに負荷をかけてみても、id 80%以下にはならない様子、
この仮想マシンで使えるリソースは制限されていると推測される。

m1220
行動しなければ何も得られないですね
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away