Documentation
¶
Overview ¶
Package makeload is a load generation library for testing. See the README for usage information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatteryProperties ¶ added in v0.2.0
type BatteryProperties struct {
// Concurrency is the number of concurrent request processors to make at a
// time.
Concurrency uint
// SimultaneousConnections is the number of connections to maintain open at
// any given time.
SimultaneousConnections uint
// URL is the url to connect to,
URL *url.URL
// Ctx is a context which, if canceled, will stop load generation.
Ctx context.Context
// Stats is the statistics generated by already processed load generation.
Stats Stats
// Requester is the interface to HTTP requests.
Requester
// contains filtered or unexported fields
}
BatteryProperties are the list of properties common to each load generator.
type Benchmarker ¶ added in v0.2.0
type Benchmarker struct {
Properties *BatteryProperties
Time time.Duration
}
Benchmarker is the main load generator struct for managing benchmarking. Call Spawn() on the result.
func NewBenchmarker ¶ added in v0.2.0
func NewBenchmarker(properties *BatteryProperties, duration time.Duration) *Benchmarker
func (*Benchmarker) Spawn ¶ added in v0.2.0
func (b *Benchmarker) Spawn() error
Spawn launches the benchmarker. It will return an error if there was an error generating load. It does not error if there were issues making the individual HTTP requests. The Stats struct tracks the count of failures.
To cancel load generation, cancel a passed context.
type LoadGenerator ¶
type LoadGenerator struct {
Properties *BatteryProperties
TotalConnections uint
}
LoadGenerator is the main load generator struct for managing load generation. One would construct this struct, filling out the proper parameters, and then would run Spawn() on the struct to apply load.
func NewLoadGenerator ¶ added in v0.2.0
func NewLoadGenerator(properties *BatteryProperties, total uint) *LoadGenerator
func (*LoadGenerator) Spawn ¶
func (lg *LoadGenerator) Spawn() error
Spawn launches the load generator. It will return an error if there was an error generating load. It does not error if there were issues making the individual HTTP requests. The Stats struct tracks the count of failures.
To cancel load generation, cancel a passed context.
type Requester ¶
type Requester interface {
// Code to run when HTTP request delivery is made.
Deliver(*url.URL) error
}
Requester is an interface to modify how requests are made to the remote service. If supplied to the LoadGenerator struct, it will be used. Alternatively, LoadGenerator already supplies its own implementation.