Installation
- brew install vegetamacOS
- go install github...Go install
- Download binaryGitHub releases
- vegeta -versionCheck version
Basic Attack Command
# Basic attack (pipe targets)
echo "GET http://localhost:8080/" | vegeta attack -duration=30s | vegeta report
# From targets file
vegeta attack -targets=targets.txt -rate=100 -duration=60s | vegeta report
# Save results to file
vegeta attack -targets=targets.txt -rate=50 -duration=30s > results.bin
Attack Options
- -rateRequests/sec
- -durationTest duration
- -targetsTargets file
- -timeoutRequest timeout
- -workersWorker count
- -connectionsMax connections
- -max-bodyMax body bytes
Target Format
# targets.txt format
GET http://localhost/
GET http://localhost/api/users
POST http://localhost/api/users
Content-Type: application/json
@body.json
DELETE http://localhost/api/1
Report Metrics
- RequestsTotal count
- RateActual req/sec
- ThroughputSuccess rate/sec
- Latenciesp50, p95, p99
- SuccessSuccess ratio
- Status CodesResponse codes
Encode Command
- vegeta encodeConvert format
- -to jsonOutput as JSON
- -to csvOutput as CSV
- -to gobGo binary format
Common Workflows
# Quick test with report
echo "GET http://api.example.com/" | vegeta attack -duration=10s | vegeta report
# Save and analyze later
vegeta attack -targets=targets.txt -rate=100 -duration=5m > results.bin
vegeta report < results.bin
vegeta report -type=json < results.bin > report.json
# Generate HTML plot
vegeta plot < results.bin > plot.html
# Combine multiple results
vegeta attack -rate=50 ... > r1.bin && vegeta attack -rate=100 ... > r2.bin
cat r1.bin r2.bin | vegeta report
Plot Command
- vegeta plotGenerate HTML
- -title "Test"Chart title
- -thresholdLatency threshold
- Interactive chartZoomable HTML
Report Types
- -type=textDefault text
- -type=jsonJSON output
- -type=histHistogram
- -type=hdrplotHDR histogram
Advanced Targets with Headers & Body
# targets.txt with headers and body
POST http://api.example.com/users
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6...
X-Request-ID: test-123
{"username": "testuser", "email": "test@example.com"}
GET http://api.example.com/users/1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6...
Rate Patterns
- -rate=100100 req/sec
- -rate=0Max rate (no limit)
- -rate=100/1s100 per second
- -rate=1/100ms1 per 100ms
Key Features
- Constant ratePrecise load
- Binary outputSmall & fast
- Pipe-friendlyUnix composable
- HDR histogramsAccurate stats