started creating rapid attack command
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
vegeta "github.com/tsenart/vegeta/lib"
|
||||
vegeta "github.com/senaduka/vegeta/lib"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -64,7 +64,7 @@ func attack(rate uint64, duration time.Duration, targetsf, ordering, output stri
|
||||
}
|
||||
defer out.Close()
|
||||
|
||||
log.Printf("Vegeta is attacking %d targets in %s order for %s...\n", len(targets), ordering, duration)
|
||||
log.Printf("Vegeta is attacking %d targets in %s order for %s with %d requests/sec...\n", len(targets), ordering, duration, rate)
|
||||
results := vegeta.Attack(targets, rate, duration)
|
||||
log.Println("Done!")
|
||||
log.Printf("Writing results to '%s'...", output)
|
||||
@@ -74,6 +74,8 @@ func attack(rate uint64, duration time.Duration, targetsf, ordering, output stri
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
const (
|
||||
errRatePrefix = "Rate: "
|
||||
errDurationPrefix = "Duration: "
|
||||
|
||||
@@ -16,6 +16,7 @@ type Result struct {
|
||||
BytesOut uint64
|
||||
BytesIn uint64
|
||||
Error string
|
||||
Rate uint64
|
||||
}
|
||||
|
||||
// Results is a slice of Result structs with encoding,
|
||||
|
||||
2
main.go
2
main.go
@@ -18,6 +18,7 @@ var usage = fmt.Sprintf(
|
||||
Commands:
|
||||
attack Hit the targets
|
||||
report Report the results
|
||||
rapid Hit the targets with multiple rates
|
||||
|
||||
Globals:
|
||||
-cpus=%d Number of CPUs to use
|
||||
@@ -34,6 +35,7 @@ func main() {
|
||||
commands := map[string]func([]string) command{
|
||||
"attack": attackCmd,
|
||||
"report": reportCmd,
|
||||
"rapid": rapidCmd,
|
||||
}
|
||||
|
||||
args := flag.Args()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
for OS in "linux" "darwin"; do
|
||||
for ARCH in "386" "amd64"; do
|
||||
for ARCH in "amd64"; do
|
||||
GOOS=$OS CGO_ENABLED=0 GOARCH=$ARCH go build -o vegeta
|
||||
REV=$(git rev-parse HEAD)
|
||||
ARCHIVE=vegeta-$OS-$ARCH-${REV:0:7}.tar.gz
|
||||
|
||||
Reference in New Issue
Block a user