« Back to Index

[Vegeta load test examples https://github.com/tsenart/vegeta]

View original Gist on GitHub

Tags: #go #golang #vegeta #examples #loadtest #benchmark #report

vegeta load test.sh

echo "GET http://google.com" | vegeta attack -duration=5s -rate=2 -cert=/path/to/certificate.pem | tee results.bin | vegeta report

# you don't have to pipe the data to `vegeta report`, 
# you can instead run it as a separate command...
#
# echo "GET http://google.com" | vegeta attack -duration=5s | tee results.bin
# vegeta report results.bin
#
# in the vegeta results you might be confused by the `Status Codes` section:
#
# e.g. Status Codes  [code:count]             0:45  200:5723  500:33  502:13  503:186
#
# ...this just means the code (let's use `200 OK` as an example), was received 5723 times.
# where as a zero code means there was a problem sending the request.

cat results.bin | vegeta report -reporter=plot > plot.html

# alternative ploting graph approach...
#
# vegeta plot -title=Attack%20Results results.bin > results.html
#
# ...you can also generate the report as JSON...
#
# vegeta report -type=json results.bin
#
# to use an external file use `-targets=target.list` where the targets file is...
#
# GET http://<application_url>/list/user/1
# GET http://<application_url>/list/user/2
# GET http://<application_url>/list/user/3
#
# it can also contain POST data...
#
# POST http://<application_url>/create/newuser/
# Content-Type: application/json
# @/path/to/newuser.json
#
# ...where the file /path/to/newuser.json contains...
#
# {
#  "name": "Peter";
#  "lastname": "Smith";
#  "email": "psmith@example.com"
# }