Documentation
¶
Index ¶
- func AskForConfirmation(s string, in io.Reader) bool
- func RegisterHatchRate(name string, constructor HatchRateConstructor) error
- func RegisterInvoker(name string, constructor InvokerConstructor) error
- func SetDefaultLogger(_log *logrus.Entry)
- type Bencher
- func BencherFromConfig(config BenchmarkConfig, workload Workload) (*Bencher, error)
- func BencherFromConfigFile(configFile io.ReadCloser) (*Bencher, error)
- func BencherReadFromConfig(config BenchmarkConfig) (*Bencher, error)
- func WithPayloadFunc(bencher *Bencher, payloadFunc PayloadFunc) *Bencher
- func WithPhasePostRun(phaseIndex int, bencher *Bencher, runFunc PostRunFunc) *Bencher
- func WithPhasePreRun(phaseIndex int, bencher *Bencher, runFunc PreRunFunc) *Bencher
- func WithPostRun(bencher *Bencher, runFunc PostRunFunc) *Bencher
- func WithPreRun(bencher *Bencher, runFunc PreRunFunc) *Bencher
- type BenchmarkConfig
- type ConstantRate
- type FixedRPSRate
- type FunctionAPIInvoker
- type HTTPInvoker
- type HatchRate
- type HatchRateConfig
- type HatchRateConstructor
- type Invoker
- type InvokerConfig
- type InvokerConstructor
- type NoopRate
- type PayloadFunc
- type Phase
- type PhaseConfig
- type PostRunFunc
- type PreRunFunc
- type SlopingRate
- type WhiskInvoker
- type Workload
- type WorkloadConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskForConfirmation ¶ added in v0.0.5
askForConfirmation asks the user for confirmation. A user must type in "yes" or some similar confirmation, no by default
func RegisterHatchRate ¶
func RegisterHatchRate(name string, constructor HatchRateConstructor) error
RegisterHatchRate is an extension method to register new HatchRates used for config resolution
func RegisterInvoker ¶
func RegisterInvoker(name string, constructor InvokerConstructor) error
Extension Method to register more invoker used during config parsing
func SetDefaultLogger ¶
Types ¶
type Bencher ¶
type Bencher struct { //Some sort of Logger/Writer //Worker pool Work Workload Strict bool // contains filtered or unexported fields }
func BencherFromConfig ¶
func BencherFromConfig(config BenchmarkConfig, workload Workload) (*Bencher, error)
func BencherFromConfigFile ¶
func BencherFromConfigFile(configFile io.ReadCloser) (*Bencher, error)
func BencherReadFromConfig ¶ added in v0.0.5
func BencherReadFromConfig(config BenchmarkConfig) (*Bencher, error)
func WithPayloadFunc ¶
func WithPayloadFunc(bencher *Bencher, payloadFunc PayloadFunc) *Bencher
func WithPhasePostRun ¶
func WithPhasePostRun(phaseIndex int, bencher *Bencher, runFunc PostRunFunc) *Bencher
func WithPhasePreRun ¶
func WithPhasePreRun(phaseIndex int, bencher *Bencher, runFunc PreRunFunc) *Bencher
func WithPostRun ¶
func WithPostRun(bencher *Bencher, runFunc PostRunFunc) *Bencher
func WithPreRun ¶
func WithPreRun(bencher *Bencher, runFunc PreRunFunc) *Bencher
type BenchmarkConfig ¶
type BenchmarkConfig struct { OutputFile string `json:"output" yaml:"output"` Workload WorkloadConfig `json:"workload" yaml:"workload"` }
type ConstantRate ¶
type ConstantRate struct { TotalRequests uint64 sync.RWMutex // contains filtered or unexported fields }
func (*ConstantRate) Close ¶
func (f *ConstantRate) Close() error
func (*ConstantRate) OnFailed ¶
func (f *ConstantRate) OnFailed()
func (*ConstantRate) OnQueued ¶
func (f *ConstantRate) OnQueued()
func (*ConstantRate) OnSuccess ¶
func (f *ConstantRate) OnSuccess()
func (*ConstantRate) Take ¶
func (f *ConstantRate) Take() error
type FixedRPSRate ¶
type FixedRPSRate struct { RPS int64 BypassAtFailure bool // contains filtered or unexported fields }
func (*FixedRPSRate) Close ¶
func (f *FixedRPSRate) Close() error
func (*FixedRPSRate) OnFailed ¶
func (f *FixedRPSRate) OnFailed()
func (*FixedRPSRate) OnQueued ¶
func (f *FixedRPSRate) OnQueued()
func (*FixedRPSRate) OnSuccess ¶
func (f *FixedRPSRate) OnSuccess()
func (*FixedRPSRate) Take ¶
func (f *FixedRPSRate) Take() error
type FunctionAPIInvoker ¶
type FunctionAPIInvoker interface { Invoker }
type HTTPInvoker ¶
type HTTPInvoker struct { Request *http.Request RequestBody []byte // DisableCompression is an option to disable compression in response DisableCompression bool // DisableKeepAlive is an option to prevents re-use of TCP connections between different HTTP requests DisableKeepAlive bool // DisableRedirects is an option to prevent the following of HTTP redirects DisableRedirects bool // H2 is an option to make HTTP/2 requests H2 bool // Timeout in seconds. Timeout int // contains filtered or unexported fields }
TODO: needs testing
func (*HTTPInvoker) Exec ¶
func (h *HTTPInvoker) Exec(rate HatchRate) error
type HatchRate ¶
type HatchRate interface { //function is called once before starting the phase Setup(context.Context, *Phase) (*sync.Cond, error) //function should block until the next request should be made Take() error //call if the invocation was successful OnSuccess() //call if the invocation failed OnFailed() //call if the invocation was queued OnQueued() Close() error }
func NewRateFromConfig ¶
func NewRateFromConfig(config HatchRateConfig) (HatchRate, error)
type HatchRateConfig ¶
type HatchRateConstructor ¶
type HatchRateConstructor func(config HatchRateConfig) (HatchRate, error)
type Invoker ¶
type Invoker interface { Setup(context.Context, *Phase, *Bencher) error Exec(rate HatchRate) error }
func NewInvokerFromConfig ¶
func NewInvokerFromConfig(config InvokerConfig) (Invoker, error)
type InvokerConfig ¶
type InvokerConstructor ¶
type InvokerConstructor func(config InvokerConfig) (Invoker, error)
type NoopRate ¶
type NoopRate struct {
// contains filtered or unexported fields
}
type PayloadFunc ¶
type Phase ¶
type Phase struct { Name string //unique name, might be used to identify this phase Threads int //number of threads that send the invocation HatchRate HatchRate //hatch rate, that governs how often new invocations are performed Timeout time.Duration //max duration of this phase Target string //the target of this workload, can be an url or platfrom identifier (e.g. function name) PayloadFunc PayloadFunc //if set this function is called during _each_ invocation to generate a payload, use for authentication PreRun PreRunFunc //if set this function will be called _once_ before running the phase PostRun PostRunFunc //if set this function will be called _once_ after running the phase Invocation Invoker //the invocation of this phase, e.g. HTTP or CLI }
type PhaseConfig ¶
type PhaseConfig struct { Name string `json:"name" yaml:"name"` Threads int `json:"threads" yaml:"threads"` HatchRate HatchRateConfig `json:"hatchRate" yaml:"hatchRate"` Timeout time.Duration `json:"timeout" yaml:"timeout"` }
type PostRunFunc ¶
type PostRunFunc func() error
type PreRunFunc ¶
type PreRunFunc func() error
type SlopingRate ¶
type SlopingRate struct { StartRate int64 HatchRate float64 BypassAtFailure bool // contains filtered or unexported fields }
func (*SlopingRate) Close ¶
func (r *SlopingRate) Close() error
func (*SlopingRate) OnFailed ¶
func (r *SlopingRate) OnFailed()
func (*SlopingRate) OnQueued ¶
func (r *SlopingRate) OnQueued()
func (*SlopingRate) OnSuccess ¶
func (r *SlopingRate) OnSuccess()
func (*SlopingRate) Take ¶
func (r *SlopingRate) Take() error
type WhiskInvoker ¶
type WhiskInvoker struct { FunctionName string RequestPerMinute int64 Host string Token string Request interface{} // contains filtered or unexported fields }
func (*WhiskInvoker) Exec ¶
func (l *WhiskInvoker) Exec(rate HatchRate) error
type Workload ¶
type Workload struct { Name string Target string //the target of this workload, can be an url or platfrom identifier (e.g. function name) PreRun PreRunFunc //if set this function will be called once before the benchmark Phases []Phase //phases of the workload PostRun PostRunFunc //if set this function will be called once after the benchmark }
type WorkloadConfig ¶
type WorkloadConfig struct { Name string `json:"name" yaml:"name"` Target string `json:"target" yaml:"target"` Phases []PhaseConfig `json:"phases" yaml:"phases"` Invocation InvokerConfig `json:"invoker" yaml:"invoker"` }
func (WorkloadConfig) Unmarshal ¶
func (c WorkloadConfig) Unmarshal() (Workload, error)
Click to show internal directories.
Click to hide internal directories.