Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Simple performance testing using ab

Shushu Inbar edited this page Mar 9, 2014 · 7 revisions

When testing performance the main issue is the difference between before/after a change. There is no real success/failure, mainly a reasonable response time, and response time change in percentage.

When testing performance, it is also important not to just execute one request, but to make some kind of load on the server.

Apache Benchmark is a quick and simple testing tool that can be useful for such a quick test.

Notes:
If you need to test an authenticated user you need to follow some steps (TBD) to make use of an existing session.
If you test as an anonymous user, just make sure the caching for anonymous is disabled.

Simple example

$ ab -n 100 -c 5 http://yoursite.com
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 http://yoursite.com (be patient).....done

Server Software:        10.176.69.43
Server Hostname:        http://yoursite.com
Server Port:            80

Document Path:          /
Document Length:        30649 bytes

Concurrency Level:      5
Time taken for tests:   12.854 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      3118447 bytes
HTML transferred:       3064900 bytes
Requests per second:    7.78 [#/sec] (mean)
Time per request:       **642.705** [ms] (mean)
Time per request:       128.541 [ms] (mean, across all concurrent requests)
Transfer rate:          236.92 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       60   81  32.5     73     258
Processing:   411  554 150.2    496    1213
Waiting:       82  131 100.5    109     794
Total:        471  635 162.9    574    1280

Percentage of the requests served within a certain time (ms)
  50%    574
  66%    614
  75%    646
  80%    696
  90%    899
  95%   1010
  98%   1170
  99%   1280
 100%   1280 (longest request)

Clone this wiki locally