← 返回命令列表

Linux command

vegeta 命令

网络

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Attack endpoint

echo "GET http://localhost:8080/" | vegeta attack -rate=[50] | vegeta report

Attack with duration

echo "GET http://localhost/" | vegeta attack -rate=[100] -duration=[30s] | vegeta report

Plot results

vegeta attack ... | vegeta plot > [results.html]

Encode to JSON

vegeta attack ... | vegeta encode --to=json

From targets file

vegeta attack -targets=[targets.txt] -rate=[10]

POST request

echo "POST http://localhost/api" | vegeta attack -body=[data.json]

说明

vegeta is an HTTP load testing tool that sends requests at a constant, configurable rate. The attack command generates traffic and streams binary results to stdout, which can be piped to report for statistical analysis or plot for HTML visualization. This pipeline design allows flexible composition of load test workflows. Target definitions support multiple endpoints, HTTP methods, headers, and request bodies. Reports include latency percentiles, success rates, and throughput metrics, making it straightforward to identify performance regressions and capacity limits.

参数

attack
Send requests.
report
Generate report.
plot
HTML plot.
encode
Convert format.
-rate _N_
Requests per second.
-duration _D_
Attack duration.
-targets _FILE_
Targets file.
-body _FILE_
Request body.
-header _H_
HTTP header.

FAQ

What is the vegeta command used for?

vegeta is an HTTP load testing tool that sends requests at a constant, configurable rate. The attack command generates traffic and streams binary results to stdout, which can be piped to report for statistical analysis or plot for HTML visualization. This pipeline design allows flexible composition of load test workflows. Target definitions support multiple endpoints, HTTP methods, headers, and request bodies. Reports include latency percentiles, success rates, and throughput metrics, making it straightforward to identify performance regressions and capacity limits.

How do I run a basic vegeta example?

Run `echo "GET http://localhost:8080/" | vegeta attack -rate=[50] | vegeta report` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does attack do in vegeta?

Send requests.