Skip to content

Instantly share code, notes, and snippets.

@Integralist
Last active February 7, 2022 13:30
Show Gist options
  • Save Integralist/584f6a4cf0a607a9da52 to your computer and use it in GitHub Desktop.
Save Integralist/584f6a4cf0a607a9da52 to your computer and use it in GitHub Desktop.
[Vegeta load test examples https://github.com/tsenart/vegeta] #go #golang #vegeta #examples #loadtest #benchmark #report
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"
# }
@Abhinickz
Copy link

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

Above command should change to below command for this version:

$ vegeta --version
Version: 
Commit: 
Runtime: go1.11.4 linux/amd64
Date:  

cat results.bin | vegeta plot > plot.html

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