Previous: , Up: Testing and Developing Trip   [Contents][Index]


8.5 Load Testing

Load testing can be done with curl and ab (Apache Bench, usually installed with Apache 2).

  1. Login and get a valid session ID as described above using curl. See Testing with Curl.
  2. Test fetching a single page with ab using the session ID obtained from the previous command:
    $ ab -v 3 \
    -C 'TRIP_SESSION_ID=b3571314-d5c4-4690-8164-8384fd748faa' \
    http://localhost:8080/trip/app/tracks
    
  3. Make sure the response gives a valid response, proving the session ID is valid and working.
  4. Add the options -n 1000 -c 50 to perform 1,000 page fetches, with a maximum of 50 concurrent requests. Add the -k option if you want to test keep-alive requests. Make sure to configure the build with the --enable-keep-alive option.

If using keep-alive, it’s best to limit the number of concurrent requests to no more than the number of workers the application has been configured to start, otherwise some requests will fail. As far as I understand, there is no real benefit using keep-alive these days, so by default it is disabled in the build.