loadgenerator

package
v0.0.0-...-355f60d Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddHostHeader  = 0
	EnableProfiler = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GeneratorOptions

type GeneratorOptions struct {
	// Duration is the total time to generate the load.
	// If NumSteps is specified, this value will hold true for each step.
	Duration time.Duration
	// NumThreads is the number of threads generating the load.
	NumThreads int
	// NumConnections controls the number of idle connections Transport keeps.
	NumConnections int
	// URL is the endpoint of the target service.
	URL string
	// Domain is the domain name of the target service.
	Domain string
	// RequestTimeout is the maximum time waiting for a response.
	RequestTimeout time.Duration
	// BaseQPS is the total QPS generated by all threads.
	// The load factors defines the multiplier for the ultimate QPS used.
	BaseQPS float64
	// AllowInitialErrors specifies whether initial errors will abort the load.
	AllowInitialErrors bool
	// LoadFactors defines the multiplier for baseQPS.
	// Len(loadfactors) defines the number of QPS changes.
	LoadFactors []float64
	// FileNamePrefix is the prefix used to identify the stored files in artifacts.
	// If not empty, this can be used to store cpu/mem profile from loadgenerator.
	// Typically, we can use t.Name() to differentiate between the tests.
	FileNamePrefix string
}

GeneratorOptions provides knobs to run the perf test

func (*GeneratorOptions) CreateRunnerOptions

func (g *GeneratorOptions) CreateRunnerOptions(opts []int) (*fhttp.HTTPRunnerOptions, error)

CreateRunnerOptions sets up the fortio client with the knobs needed to run the load test

func (*GeneratorOptions) RunLoadTest

func (g *GeneratorOptions) RunLoadTest(opts ...int) (*GeneratorResults, error)

RunLoadTest runs the load test with fortio and returns the response By default, LoadFactors = [1] => test full load directly with no intermediate steps

For LoadFactors=[1,2,4], baseQPS=q, duration=d

	QPS
	|               |---d---|
	|               |   |   |
	|       |---d---|   |4q	|
	|---d---|   |2q	    |	|
	|___|q______|_______|___|____duration(time)
            1       2       3  <--- factors

type GeneratorResults

type GeneratorResults struct {
	Result []*fhttp.HTTPRunnerResults
	// FileNamePrefix is the prefix used to identify the stored files in artifacts.
	// This will be used to store the JSON output from loadgenerator.
	// Typically, we can use t.Name() to differentiate between the tests.
	FileNamePrefix string
}

GeneratorResults contains the results of running the per test

func (*GeneratorResults) ErrorsPercentage

func (gr *GeneratorResults) ErrorsPercentage(idx int) float64

ErrorsPercentage returns the error percentage of the result[idx] based on response codes. Any non 200 response will be counted as errors.

func (*GeneratorResults) ErrorsPercentageOverall

func (gr *GeneratorResults) ErrorsPercentageOverall() float64

ErrorsPercentageOverall returns the error percentage of the result based on response codes. Any non 200 response will be counted as errors.

func (*GeneratorResults) SaveJSON

func (gr *GeneratorResults) SaveJSON() error

SaveJSON saves the results as Json in the artifacts directory

Jump to

Keyboard shortcuts

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