Vegeta — HTTP Load Testing Tool at Constant Request Rates
Fast Go HTTP load generator that sustains a precise constant request rate and emits HDR histograms, JSON reports, and latency plots.
Agent 可直接安装
这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。
npx -y tokrepo@latest install b048c0d2-38d6-11f1-9bc6-00163e2b0d79 --target codex先 dry-run 确认安装计划,再运行此命令。
What it is
Vegeta is a Go-based HTTP load testing tool that attacks endpoints at a precise constant request rate. Unlike tools that ramp up connections until the server breaks, Vegeta maintains the rate you specify and measures how the server responds. It produces HDR histograms, JSON reports, latency distributions, and visual plots.
Vegeta targets backend engineers, SREs, and performance testers who need reproducible load tests with accurate latency measurements.
How it saves time or tokens
Vegeta's constant-rate approach produces more meaningful results than burst-based tools. You know exactly how many requests per second were sent, making it easy to compare runs and identify regressions. The CLI piping model (attack | encode | report) is composable and scriptable.
Vegeta is a single binary with zero dependencies. No JVM, no config files, no cluster setup.
How to use
- Install Vegeta:
go install github.com/tsenart/vegeta@latestorbrew install vegeta - Create a targets file with HTTP endpoints
- Run an attack at a specified rate
- Generate reports from the results
Example
# Attack at 100 requests/second for 30 seconds
echo 'GET https://api.example.com/health' | \
vegeta attack -rate=100 -duration=30s | \
vegeta report
# Output:
# Requests [total, rate, throughput] 3000, 100.03, 99.97
# Duration [total, attack, wait] 30.01s, 29.99s, 12.1ms
# Latencies [min, mean, 50, 90, 95, 99, max] 2.1ms, 12.3ms, 10.1ms, 22.4ms, 35.6ms, 89.2ms, 210.1ms
# Success [ratio] 99.87%
# Status Codes [code:count] 200:2996 500:4
# Generate a latency plot
echo 'GET https://api.example.com/health' | \
vegeta attack -rate=100 -duration=30s | \
vegeta plot > latency.html
# Multiple endpoints with headers
cat <<EOF | vegeta attack -rate=50 -duration=10s | vegeta report
GET https://api.example.com/users
Authorization: Bearer token123
POST https://api.example.com/orders
Content-Type: application/json
@body.json
EOF
Related on TokRepo
- Testing tools -- Load testing and quality assurance
- DevOps tools -- Infrastructure and performance tools
Common pitfalls
- Running Vegeta from a machine with limited bandwidth distorts results; test from a host near the target
- Very high rates (10K+/s) may exhaust local ports; increase
ulimit -nand use connection keep-alive - Vegeta measures client-side latency including network time; compare results from the same network location
常见问题
wrk and ab maximize throughput by opening as many connections as possible. Vegeta maintains a precise constant rate. Use wrk to find the breaking point; use Vegeta to measure behavior at a specific load level.
Yes. Specify the HTTP method, headers, and body in the targets file. Use @filename to reference a body file. Vegeta supports all HTTP methods including POST, PUT, PATCH, and DELETE.
Not natively. Vegeta runs on a single machine. For distributed testing, run Vegeta on multiple machines and merge results. The binary format allows combining results from multiple sources.
Vegeta produces text reports (default), JSON reports, HDR histogram data, and HTML latency plots. The pipeline model lets you choose the output format by piping to 'vegeta report' with different flags.
Yes. Vegeta's CLI interface and exit codes make it suitable for CI/CD. Set a latency threshold and fail the pipeline if p99 exceeds it. The JSON output can be parsed by CI scripts for automated assertions.
引用来源 (3)
- Vegeta GitHub— Vegeta is a Go HTTP load testing tool
- HDR Histogram— HDR Histogram for accurate latency measurement
- Vegeta README— HTTP load testing methodology and constant-rate testing
讨论
相关资产
Artillery — Modern Load Testing for HTTP, WebSocket & More
Node.js load testing toolkit with YAML scenarios covering HTTP, WebSocket, gRPC and Playwright, plus distributed runs on AWS Fargate.
oha — HTTP Load Generator with Real-Time TUI Dashboard
HTTP load generator written in Rust with a beautiful real-time terminal UI for visualizing request latency and throughput.
Ddosify — High-Performance Load Testing and Observability Platform
Ddosify is a high-performance load testing tool written in Go that supports HTTP, HTTPS, HTTP/2, gRPC, and GraphQL protocols, with scenario-based testing and distributed execution.
Gatling — High-Performance Load Testing for Web Applications
Gatling is an open-source load and performance testing tool for web applications, built on Scala and Akka, that generates detailed HTML reports from code-defined test scenarios.