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 {
// Requester is the interface to HTTP requests.
Requester
// contains filtered or unexported fields
}
BatteryProperties are the list of properties common to each load generator.
func NewBatteryProperties ¶ added in v0.3.0
func NewBatteryProperties(ctx context.Context, concurrency, simultaneousConnections uint64, u *url.URL) *BatteryProperties
NewBatteryProperties constructs a new BatteryProperties struct, which contains load generating parameters. Use this function to build it.
func (*BatteryProperties) Deliver ¶ added in v0.2.0
func (p *BatteryProperties) Deliver(u *url.URL) error
Deliver satisfies the Requester interface and encompasses basic delivery of a HTTP GET request.
func (*BatteryProperties) Stats ¶ added in v0.2.0
func (bp *BatteryProperties) Stats() *Stats
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 uint64
}
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 uint64) *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.