Install Vegeta on Ubuntu 20.04

Install Vegeta on Ubuntu 20.04

Vegeta is an open-source HTTP load testing tool written in Go programming language. This tool allows to test web application by sending specified number of user requests simultaneously.

This tutorial demonstrates how to install Vegeta on Ubuntu 20.04.

Install Vegeta

Retrieve the latest version tag of Vegeta release and assign it to variable.

VEGETA_VERSION=$(curl -s "https://api.github.com/repos/tsenart/vegeta/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')

Run the following command to download tar.gz file from releases page of the Vegeta repository:

curl -Lo vegeta.tar.gz "https://github.com/tsenart/vegeta/releases/latest/download/vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz"

Create temporary directory and extract a tar.gz file:

mkdir vegeta-temp
tar xf vegeta.tar.gz -C vegeta-temp

Next, move executable file to /usr/local/bin directory.

sudo mv vegeta-temp/vegeta /usr/local/bin

Now vegeta command is available for all users as a system-wide command.

Remove unnecessary directories and files:

rm -rf vegeta.tar.gz
rm -rf vegeta-temp

Testing Vegeta

The vegeta command can be used in multiple ways. Run the following command to perform load testing:

echo "GET http://192.168.0.174" | vegeta attack -duration=10s -rate=5 | vegeta report

By default, Vegeta reads target URL from stdin. With echo command we pass target composed by a HTTP method GET and web application URL. In this case, load testing is performed by sending 5 requests per second for 10 seconds duration. So in total 50 requests in 10 seconds. Testing results is printed as text.

Requests      [total, rate, throughput]         50, 5.10, 5.10
Duration      [total, attack, wait]             9.796s, 9.795s, 1.135ms
Latencies     [min, mean, 50, 90, 95, 99, max]  1.094ms, 1.236ms, 1.189ms, 1.384ms, 1.51ms, 2.415ms, 2.415ms
Bytes In      [total, mean]                     535050, 10701.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:50
Error Set:

Uninstall Vegeta

If you wish to completely remove Vegeta, delete executable file:

sudo rm -rf /usr/local/bin/vegeta

Leave a Comment

Cancel reply

Your email address will not be published.