Load Testing Vegeta Locust
Posted on October 2, 2012
Tags: hacksoft
1 vegeta
1.1 Install
mkdir Vegeta
cd Vegeta
wget https://github.com/tsenart/vegeta/releases/download/v12.8.4/vegeta_12.8.4_linux_amd64.tar.gz
tar -xvzf vegeta_12.8.4_linux_amd64.tar.gz
1.2 100 hits per second
echo "GET http://192.168.1.245:3300" | ./vegeta attack -name=bleh -rate=100 -duration=5s > results.100qps.bin
1.3 As much as possible hits
- Set
-rate=0
representing infinity. Setmax-workers=100
to num of virtual threads.
echo "GET http://192.168.1.245:3300" | ./vegeta attack -name=1000qps -rate=0 -duration=15s -max-workers=100
1.4 Plotting
./vegeta plot results.100qps.bin > plot.html
1.5 Report
./vegeta report results.100qps.bin
# Requests [total, rate, throughput] 405037, 6696.28, 5508.40
# Duration [total, attack, wait] 1m7s, 1m0s, 6.869s
# Latencies [min, mean, 50, 90, 95, 99, max] 1.101ms, 6.598s, 4.256s, 16.925s, 21.484s, 26.89s, 51.645s
# Bytes In [total, mean] 5936336, 14.66
# Bytes Out [total, mean] 0, 0.00
# Success [ratio] 91.60%
# Status Codes [code:count] 0:34016 200:371021
2 Locust
pip3 install locust
from locust import HttpUser, task
class HelloWorldUser(HttpUser):
@task
def hello_world(self):
self.client.post("/api/authenticate", json={"username":"user", "password":"user", "rememberMe": "false"})