Jordan Savant // Software Engineer

Load Testing

Apache Bench

This tool will allow us to test a webpage with any number of requests at any number of concurrent connections. It's powerful and easy to use.

Setup

  1. Don't run Apache Bench on the local host
  2. Reduce network latency by using a server in the same locale
  3. Ensure you are monitoring web server performance live using monitoring tools (for Apache see below)

Running

Run 300 test with up to 40 concurrent requests at a time:

ab -n 300 -c 40 http://www.jordansavant.com/

Server Software:        AmazonS3
Server Hostname:        www.jordansavant.com
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      40
Time taken for tests:   1.045 seconds
Complete requests:      300
Failed requests:        0
Non-2xx responses:      300
Total transferred:      86700 bytes
HTML transferred:       0 bytes
Requests per second:    287.00 [#/sec] (mean)
Time per request:       139.375 [ms] (mean)
Time per request:       3.484 [ms] (mean, across all concurrent requests)
Transfer rate:          81.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       48   58   4.3     58      70
Processing:    49   63  16.9     58     244
Waiting:       49   61  16.5     57     244
Total:        103  121  16.9    117     294

Percentage of the requests served within a certain time (ms)
  50%    117
  66%    119
  75%    125
  80%    127
  90%    133
  95%    142
  98%    165
  99%    171
 100%    294 (longest request)

Keep Alive

You can pass the -k option to the test to send a "KeepAlive" header in the requests. This header is sent by browsers and is used to improve performance by keeping the TCP connection alive for followup requests. This prevents the time it takes to establish new connections for each request.

How this affects the test is that the KeepAlive header means that your webserver will be reusing the same connection across each request and therefore more processing will be spent on the page performance and less on the connection handshakes.

This is a good test for actual web traffic.

ab -k -n 100 -c 20 http://www.jordansavant.com