Skip to content

Instantly share code, notes, and snippets.

@jlyon
Last active August 29, 2015 13:57
Show Gist options
  • Save jlyon/9455813 to your computer and use it in GitHub Desktop.
Save jlyon/9455813 to your computer and use it in GitHub Desktop.
benchmarking with ab

-n : number of requests -c : concurrency -C : cookie hash (see resource below) -e : csv file to write to

Resources

Examples

# Install
sudo apt-get install apache2-utils

ab -n 100 -c 10 -e schlow.csv http://search.schlowlibrary.org/Search/Results?lookfor=clancy&type=AllFields&submit=Find&limit=20&sort=relevance


# Cycle through a urls.txt file
for i in $(cat urls.txt); do
    echo
    echo "********************************************************************************************"
    echo "$i"
    echo
    echo ab -n 50 -c 10 -e out.csv $i
done


Example output


Server Software:        Apache/2.4.6
Server Hostname:        search.schlowlibrary.org
Server Port:            80

Document Path:          /Search/Results?lookfor=clancy
Document Length:        101504 bytes

Concurrency Level:      10
Time taken for tests:   85.020 seconds
Complete requests:      100
Failed requests:        65
   (Connect: 0, Receive: 0, Length: 65, Exceptions: 0)
Write errors:           0
Total transferred:      10192230 bytes
HTML transferred:       10150430 bytes
Requests per second:    1.18 [#/sec] (mean)
Time per request:       8501.973 [ms] (mean)
Time per request:       850.197 [ms] (mean, across all concurrent requests)
Transfer rate:          117.07 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      198  770 895.6    559    7519
Processing:  2662 7462 6564.0   5508   54298
Waiting:      778 2333 1605.5   1743    6747
Total:       3216 8232 6600.8   6294   55875

Percentage of the requests served within a certain time (ms)
  50%   6294
  66%   7858
  75%   9651
  80%   9889
  90%  13572
  95%  18907
  98%  28018
  99%  55875
 100%  55875 (longest request)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment