ทดสอบ server ด้วย ApacheBench

Linux 1 ก.ย. 2016
ab -n  -c  :

-n คือ จำนวนครั้งในการทดสอบ (Number of requests)
-c คือ การส่งทดสอบพร้อมๆ กัน (concurrency)

ตัวอย่าง

$ ab -n 100 -c 20 http://lafayettecc.org/lcc_live/event/132/progress
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/

Benchmarking lafayettecc.org (be patient).....done


Server Software:        nginx/1.4.6
Server Hostname:        lafayettecc.org
Server Port:            80

Document Path:          /lcc_live/event/132/progress
Document Length:        193 bytes

Concurrency Level:      20
Time taken for tests:   13.233 seconds
Complete requests:      100
Failed requests:        1
   (Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
Non-2xx responses:      100
Total transferred:      41897 bytes
HTML transferred:       19126 bytes
Requests per second:    7.56 [#/sec] (mean)
Time per request:       2646.506 [ms] (mean)
Time per request:       132.325 [ms] (mean, across all concurrent requests)
Transfer rate:          3.09 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4    8   1.5      8      10
Processing:   532  702 1203.1    604   12609
Waiting:      532  702 1203.2    604   12609
Total:        537  709 1203.3    613   12619

Percentage of the requests served within a certain time (ms)
  50%    613
  66%    614
  75%    614
  80%    614
  90%    614
  95%    615
  98%    615
  99%  12619
 100%  12619 (longest request)

เพิ่มเติม
https://www.digitalocean.com/community/tutorials/how-to-use-apachebench-to-do-load-testing-on-an-ubuntu-13-10-vps

https://spalinux.com/2012/06/benchmark-web-server-using-ab-apachebench

แท็ก

Onyx

Just a middle-aged programmer, Can do many things but not the most.