2013-08-13 18:51:00 +02:00
|
|
|
# Vegeta
|
|
|
|
|
|
|
|
|
|
Vegeta is a versatile HTTP load testing tool built out of need to drill
|
2013-08-14 17:31:22 +02:00
|
|
|
HTTP services with a constant request rate.
|
2013-08-17 16:14:08 +02:00
|
|
|
It can be used both as a command line utility and a library.
|
2013-08-13 18:51:00 +02:00
|
|
|
|
2013-08-18 02:21:04 +02:00
|
|
|

|
2013-08-14 15:18:05 +02:00
|
|
|
|
2013-08-13 18:51:00 +02:00
|
|
|
## Install
|
2013-08-18 03:42:40 +02:00
|
|
|
### Pre-compiled executables
|
2013-08-18 03:50:39 +02:00
|
|
|
You can download already compiled executables for Linux and Mac OS X.
|
2013-08-18 03:42:40 +02:00
|
|
|
```
|
2013-08-18 03:50:39 +02:00
|
|
|
Linux 64 bit
|
2013-08-18 03:42:40 +02:00
|
|
|
URL: https://dl.dropboxusercontent.com/u/83217940/vegeta-linux-amd64.tar.gz
|
|
|
|
|
SHA256 of the executable:
|
2013-08-19 12:20:16 +02:00
|
|
|
a9c5f41e44465c28dcbc58813b3868ffefd6c8a050a12e6a7d19ec1cba021518
|
2013-08-18 03:42:40 +02:00
|
|
|
|
2013-08-18 03:50:39 +02:00
|
|
|
Linux 32 bit
|
|
|
|
|
URL: https://dl.dropboxusercontent.com/u/83217940/vegeta-linux-386.tar.gz
|
|
|
|
|
SHA256 of the executable:
|
2013-08-19 12:20:16 +02:00
|
|
|
af185355cfe405e8cb554459a27b8e502ba1bb77011cab1c676315b55a3a49b7
|
2013-08-18 03:50:39 +02:00
|
|
|
|
|
|
|
|
Mac OS X 64 bit
|
2013-08-18 03:42:40 +02:00
|
|
|
URL: https://dl.dropboxusercontent.com/u/83217940/vegeta-darwin-amd64.tar.gz
|
|
|
|
|
SHA256 of the executable:
|
2013-08-19 12:20:16 +02:00
|
|
|
3144ba0fe80ec7ea7b735718599d9fbda95eda8ecc6f6be2ac57b3cedb2f21df
|
2013-08-18 03:50:39 +02:00
|
|
|
|
|
|
|
|
Mac OS X 32 bit
|
|
|
|
|
URL: https://dl.dropboxusercontent.com/u/83217940/vegeta-darwin-386.tar.gz
|
|
|
|
|
SHA256 of the executable:
|
2013-08-19 12:20:16 +02:00
|
|
|
40a5bc50c3f9516fa01c903a0d5a1662478ac9c3da0bf00ed4a7920ffd2633ab
|
2013-08-18 03:42:40 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Source
|
2013-08-13 18:51:00 +02:00
|
|
|
You need go installed and `GOBIN` in your `PATH`. Once that is done, run the
|
|
|
|
|
command:
|
|
|
|
|
```shell
|
2013-08-18 02:01:40 +02:00
|
|
|
$ go get github.com/tsenart/vegeta
|
2013-08-13 18:51:00 +02:00
|
|
|
$ go install github.com/tsenart/vegeta
|
|
|
|
|
```
|
|
|
|
|
|
2013-08-17 16:14:08 +02:00
|
|
|
## Usage (CLI)
|
2013-08-13 18:51:00 +02:00
|
|
|
```shell
|
|
|
|
|
$ vegeta -h
|
|
|
|
|
Usage of vegeta:
|
|
|
|
|
-duration=10s: Duration of the test
|
2013-08-14 14:21:22 +02:00
|
|
|
-ordering="random": Attack ordering [sequential, random]
|
2013-08-14 17:48:51 +02:00
|
|
|
-output="stdout": Reporter output file
|
2013-08-13 18:51:00 +02:00
|
|
|
-rate=50: Requests per second
|
2013-08-17 20:13:42 +02:00
|
|
|
-reporter="text": Reporter to use [text, plot:timings]
|
2013-08-13 18:51:00 +02:00
|
|
|
-targets="targets.txt": Targets file
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### -duration
|
|
|
|
|
Specifies the amount of time to issue request to the targets.
|
|
|
|
|
The internal concurrency structure's setup has this value as a variable.
|
|
|
|
|
The actual run time of the test can be longer than specified due to the
|
|
|
|
|
responses delay.
|
|
|
|
|
|
|
|
|
|
#### -ordering
|
|
|
|
|
Specifies the ordering of target attack. The default is `random` and
|
|
|
|
|
it will randomly pick one of the targets per request without ever choosing
|
|
|
|
|
that target again.
|
|
|
|
|
The other option is `sequential` and it does what you would expect it to
|
|
|
|
|
do.
|
|
|
|
|
|
2013-08-14 17:48:51 +02:00
|
|
|
#### -output
|
|
|
|
|
Specifies the output file to which the report will be written to.
|
|
|
|
|
The default is stdout.
|
|
|
|
|
|
2013-08-13 18:51:00 +02:00
|
|
|
#### -rate
|
2013-08-15 13:56:36 +02:00
|
|
|
Specifies the requests per second rate to issue against
|
|
|
|
|
the targets. The actual request rate can vary slightly due to things like
|
|
|
|
|
garbage collection, but overall it should stay very close to the specified.
|
2013-08-13 18:51:00 +02:00
|
|
|
|
|
|
|
|
#### -reporter
|
|
|
|
|
Specifies the reporting type to display the results with.
|
2013-08-17 20:05:07 +02:00
|
|
|
The default is the text report printed to stdout.
|
|
|
|
|
##### -reporter=text
|
|
|
|
|
```
|
|
|
|
|
Time(avg) Requests Success Bytes(rx/tx)
|
|
|
|
|
152.341ms 200 17.00% 251.00/0.00
|
|
|
|
|
|
|
|
|
|
Count: 49 30 39 48 34
|
|
|
|
|
Status: 500 404 409 503 200
|
|
|
|
|
|
|
|
|
|
Error Set:
|
|
|
|
|
Server Timeout
|
|
|
|
|
Page Not Found
|
|
|
|
|
```
|
|
|
|
|
##### -reporter=plot:timings
|
2013-08-17 20:12:09 +02:00
|
|
|
Plots the request timings in SVG format.
|
2013-08-17 20:05:07 +02:00
|
|
|

|
2013-08-13 18:51:00 +02:00
|
|
|
|
|
|
|
|
#### -targets
|
|
|
|
|
Specifies the attack targets in a line sepated file. The format should
|
|
|
|
|
be as follows:
|
|
|
|
|
```
|
|
|
|
|
GET http://goku:9090/path/to/dragon?item=balls
|
2013-08-17 20:48:05 -07:00
|
|
|
GET http://user:password@goku:9090/path/to
|
2013-08-13 18:51:00 +02:00
|
|
|
HEAD http://goku:9090/path/to/success
|
|
|
|
|
...
|
|
|
|
|
```
|
|
|
|
|
|
2013-08-17 16:14:08 +02:00
|
|
|
## Usage (Library)
|
|
|
|
|
```go
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
vegeta "github.com/tsenart/vegeta/lib"
|
|
|
|
|
"time"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
2013-08-20 18:00:32 +08:00
|
|
|
targets, _ := vegeta.NewTargets([]string{"GET http://localhost:9100/"})
|
2013-08-17 16:14:08 +02:00
|
|
|
rate := uint64(100) // per second
|
|
|
|
|
duration := 4 * time.Second
|
|
|
|
|
reporter := vegeta.NewTextReporter()
|
|
|
|
|
|
|
|
|
|
vegeta.Attack(targets, rate, duration, reporter)
|
|
|
|
|
|
|
|
|
|
reporter.Report(os.Stdout)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2013-08-14 22:57:14 +02:00
|
|
|
#### Limitations
|
|
|
|
|
There will be an upper bound of the supported `rate` which varies on the
|
|
|
|
|
machine being used.
|
|
|
|
|
You could be CPU bound (unlikely), memory bound (more likely) or
|
|
|
|
|
have system resource limits being reached which ought to be tuned for
|
|
|
|
|
the process execution. The important limits for us are file descriptors
|
|
|
|
|
and processes. On a UNIX system you can get and set the current
|
|
|
|
|
soft-limit values for a user.
|
|
|
|
|
```shell
|
|
|
|
|
$ ulimit -n # file descriptors
|
|
|
|
|
2560
|
|
|
|
|
$ ulimit -u # processes / threads
|
|
|
|
|
709
|
|
|
|
|
```
|
|
|
|
|
Just pass a new number as the argument to change it.
|
2013-08-13 18:51:00 +02:00
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
|
* Add timeout options to the requests
|
2013-08-14 22:57:14 +02:00
|
|
|
* Cluster mode (to overcome single machine limits)
|
2013-08-13 18:51:00 +02:00
|
|
|
|
|
|
|
|
## Licence
|
2013-08-17 20:13:05 +02:00
|
|
|
```
|
2013-08-17 20:10:59 +02:00
|
|
|
The MIT License (MIT)
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2013 Tomás Senart
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
|
|
this software and associated documentation files (the "Software"), to deal in
|
|
|
|
|
the Software without restriction, including without limitation the rights to
|
|
|
|
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
|
|
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
|
|
|
subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
|
|
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
|
|
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2013-08-17 20:13:05 +02:00
|
|
|
```
|