boomer

package
v0.0.0-...-564f9c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2018 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package boomer provides commands to run load tests and display results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Boomer

type Boomer struct {
	// Request is the request to be made.
	Request *fasthttp.Request
	Addr    string

	// Timeout in seconds.
	Timeout        time.Duration
	ConnectTimeout time.Duration
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration

	// C is the concurrency level, the number of concurrent workers to run.
	C uint

	// N is the total number of requests to make.
	N uint

	// F is a flag to abort execution on a request failure
	F bool

	// Duration is the amount of time the test should run.
	Duration time.Duration
	// contains filtered or unexported fields
}

Boomer is the structure responsible for performing requests.

func NewBoomer

func NewBoomer(addr string, req *fasthttp.Request) *Boomer

NewBoomer returns a new instance of Boomer for the specified request.

func (*Boomer) Results

func (b *Boomer) Results() <-chan Result

Results returns receive-only channel of results

func (*Boomer) Run

func (b *Boomer) Run()

Run makes all the requests, prints the summary. It blocks until all work is done.

func (*Boomer) Stop

func (b *Boomer) Stop()

Stop indicates Boomer to stop processing new requests

func (*Boomer) Wait

func (b *Boomer) Wait()

Wait blocks until Boomer successfully finished or is fully stopped

func (*Boomer) WithAbortionOnFailure

func (b *Boomer) WithAbortionOnFailure(f bool) *Boomer

WithAbortionOnFailure determines if pla should stop if any request fails

func (*Boomer) WithAmount

func (b *Boomer) WithAmount(n uint) *Boomer

WithAmount specifies the total amount of requests Boomer should execute.

func (*Boomer) WithConcurrency

func (b *Boomer) WithConcurrency(c uint) *Boomer

WithConcurrency determines the amount of concurrency Boomer should use. Defaults to the amount of cores of the running machine.

func (*Boomer) WithDuration

func (b *Boomer) WithDuration(d time.Duration) *Boomer

WithDuration specifies the duration of the test that Boomer will perform.

func (*Boomer) WithRateLimit

func (b *Boomer) WithRateLimit(n uint, rate time.Duration) *Boomer

WithRateLimit configures Boomer to never overpass a certain rate.

func (*Boomer) WithTimeout

func (b *Boomer) WithTimeout(t time.Duration) *Boomer

WithTimeout specifies the timeout for every request made by Boomer.

type Result

type Result struct {
	Err           error
	StatusCode    int
	Duration      time.Duration
	ContentLength int
}

Result keeps information of a request done by Boomer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL