Skip to content

Commit

Permalink
Adding workers flag to configure higher worker counts for super high …
Browse files Browse the repository at this point in the history
…load testing
  • Loading branch information
dmitri-lerko committed Jan 4, 2023
1 parent 24a7748 commit 07796d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ func main() {
timeout := flag.Int("timeout", 10, "HTTP client timeout in seconds")
strict := flag.Bool("strict", false, "Panic on bad input")
memprofile := flag.String("memprofile", "", "Write memory profile to `file` before exit")
numWorkers := flag.Int("workers", 1000, "Number of client workers to use")

flag.Parse()

exitCode := ripley.Replay(*paceStr, *silent, *dryRun, *timeout, *strict)
exitCode := ripley.Replay(*paceStr, *silent, *dryRun, *timeout, *strict, *numWorkers)
defer os.Exit(exitCode)

if *memprofile != "" {
Expand Down
4 changes: 2 additions & 2 deletions pkg/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"time"
)

func Replay(phasesStr string, silent, dryRun bool, timeout int, strict bool) int {
func Replay(phasesStr string, silent, dryRun bool, timeout int, strict bool, numWorkers int) int {
// Default exit code
var exitCode int = 0
// Ensures we have handled all HTTP request results before exiting
Expand All @@ -52,7 +52,7 @@ func Replay(phasesStr string, silent, dryRun bool, timeout int, strict bool) int
scanner := bufio.NewScanner(os.Stdin)

// Start HTTP client goroutine pool
startClientWorkers(1000, requests, results, dryRun, timeout)
startClientWorkers(numWorkers, requests, results, dryRun, timeout)
pacer.start()

for scanner.Scan() {
Expand Down

0 comments on commit 07796d7

Please sign in to comment.