govuk-load-testing: Uploading results
To make sure that load testing results are available again in the future, we can upload the results to an S3 bucket. This is especially useful if we need to reprovision the Gatling machine which means we lose the results kept on the machine itself.
1. Find a good place to upload the results
The S3 bucket to store the results in Staging is
gatling-results-staging
. In the future we might have buckets in
other environments, but for now, load testing has only been happening against
staging.
To make sure results are easy to find in the future, make sure to follow the existing directory structure:
/<%= test_plan %>/<%= date %>-<%= number_of_workers %>-workers-%<= number_of_seconds %>-seconds
If it makes sense to deviate from the number of workers and number of seconds format (if different parameters are used) then that's fine.
An example of a good upload path:
/dynamic-lists/2019-09-05-80000-workers-600-seconds
2. Make a record of the Gatling command
To make it easy to re-run a load test again, it would be useful to make a
record of the command being run for the test. You can store that in a file
called command.txt
.
Note: you should remove any secrets from the command before saving it, for example rate limiting tokens.
It may also be relevant to store information about the infrastructure at the time the command was run, for example if an unusual number of frontend machines were provisioned.
3. Get the results off the Gatling machine
After the load test has finished, Gatling will tell you where to find the results. Something like this:
Reports generated in 285s.
Please open the following file: /usr/local/bin/gatling/results/dynamiclists-20190906091551610/index.html
gatling@ec2-staging-govuk-gatling-ip-10-12-4-83:/usr/local/bin/gatling$
You can use scp
to copy that onto your own computer ready for uploading:
$ scp -r 10.12.4.83.staging-aws:/usr/local/bin/gatling/results/dynamiclists-20190906091551610 ~/Downloads
To scp
via the jumpbox:
$ scp -r -oProxyJump=jumpbox.staging.govuk.digital 10.12.4.83:/usr/local/bin/gatling/results/dynamiclists-20190906091551610 ~/Downloads
4. Upload Gatling HTML files
Once you have a place to upload the results, all you need to do is upload all the HTML, CSS and JS files that are part of a Gatling results directory.
You can do this using the S3 web interface, by clicking the "Upload" button once you're in the right directory. You can leave all the upload settings as the defaults.
Don't forget to upload your command.txt
file as well.
5. Test the results can be seen
When the upload has finished, it should be possible to view the results by going to:
https://gatling-results-staging.s3-eu-west-1.amazonaws.com//index.html
Note: you will need to be either in the office or connected to the VPN to see the results.