Documentation ¶
Index ¶
- Variables
- func DeriveScenariosFromShortcuts(opts lib.Options) (lib.Options, error)
- type BaseConfig
- func (bc BaseConfig) GetEnv() map[string]string
- func (bc BaseConfig) GetExec() string
- func (bc BaseConfig) GetGracefulStop() time.Duration
- func (bc BaseConfig) GetName() string
- func (bc BaseConfig) GetStartTime() time.Duration
- func (bc BaseConfig) GetTags() map[string]string
- func (bc BaseConfig) GetType() string
- func (bc BaseConfig) IsDistributable() bool
- func (bc BaseConfig) Validate() (errors []error)
- type BaseExecutor
- type ConstantArrivalRate
- type ConstantArrivalRateConfig
- func (carc ConstantArrivalRateConfig) GetDescription(et *lib.ExecutionTuple) string
- func (carc ConstantArrivalRateConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
- func (carc ConstantArrivalRateConfig) GetMaxVUs(et *lib.ExecutionTuple) int64
- func (carc ConstantArrivalRateConfig) GetPreAllocatedVUs(et *lib.ExecutionTuple) int64
- func (carc ConstantArrivalRateConfig) HasWork(et *lib.ExecutionTuple) bool
- func (carc ConstantArrivalRateConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
- func (carc *ConstantArrivalRateConfig) Validate() []error
- type ConstantVUs
- type ConstantVUsConfig
- func (clvc ConstantVUsConfig) GetDescription(et *lib.ExecutionTuple) string
- func (clvc ConstantVUsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
- func (clvc ConstantVUsConfig) GetVUs(et *lib.ExecutionTuple) int64
- func (clvc ConstantVUsConfig) HasWork(et *lib.ExecutionTuple) bool
- func (clvc ConstantVUsConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
- func (clvc ConstantVUsConfig) Validate() []error
- type ExecutionConflictError
- type ExternallyControlled
- func (mex *ExternallyControlled) GetConfig() lib.ExecutorConfig
- func (mex *ExternallyControlled) GetCurrentConfig() ExternallyControlledConfig
- func (mex ExternallyControlled) GetLogger() *logrus.Entry
- func (mex ExternallyControlled) GetProgress() *pb.ProgressBar
- func (mex ExternallyControlled) Init(ctx context.Context) error
- func (mex *ExternallyControlled) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
- func (mex *ExternallyControlled) SetPaused(paused bool) error
- func (mex *ExternallyControlled) UpdateConfig(ctx context.Context, newConf interface{}) error
- type ExternallyControlledConfig
- func (mec ExternallyControlledConfig) GetDescription(_ *lib.ExecutionTuple) string
- func (mec ExternallyControlledConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
- func (mec ExternallyControlledConfig) HasWork(_ *lib.ExecutionTuple) bool
- func (ExternallyControlledConfig) IsDistributable() bool
- func (mec ExternallyControlledConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
- func (mec ExternallyControlledConfig) Validate() []error
- type ExternallyControlledConfigParams
- type PerVUIterations
- type PerVUIterationsConfig
- func (pvic PerVUIterationsConfig) GetDescription(et *lib.ExecutionTuple) string
- func (pvic PerVUIterationsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
- func (pvic PerVUIterationsConfig) GetIterations() int64
- func (pvic PerVUIterationsConfig) GetVUs(et *lib.ExecutionTuple) int64
- func (pvic PerVUIterationsConfig) HasWork(et *lib.ExecutionTuple) bool
- func (pvic PerVUIterationsConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
- func (pvic PerVUIterationsConfig) Validate() []error
- type RampingArrivalRate
- type RampingArrivalRateConfig
- func (varc RampingArrivalRateConfig) GetDescription(et *lib.ExecutionTuple) string
- func (varc RampingArrivalRateConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
- func (varc RampingArrivalRateConfig) GetMaxVUs(et *lib.ExecutionTuple) int64
- func (varc RampingArrivalRateConfig) GetPreAllocatedVUs(et *lib.ExecutionTuple) int64
- func (varc RampingArrivalRateConfig) HasWork(et *lib.ExecutionTuple) bool
- func (varc RampingArrivalRateConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
- func (varc *RampingArrivalRateConfig) Validate() []error
- type RampingVUs
- type RampingVUsConfig
- func (vlvc RampingVUsConfig) GetDescription(et *lib.ExecutionTuple) string
- func (vlvc RampingVUsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
- func (vlvc RampingVUsConfig) GetGracefulRampDown() time.Duration
- func (vlvc RampingVUsConfig) GetStartVUs(et *lib.ExecutionTuple) int64
- func (vlvc RampingVUsConfig) HasWork(et *lib.ExecutionTuple) bool
- func (vlvc RampingVUsConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
- func (vlvc RampingVUsConfig) Validate() []error
- type SharedIterations
- type SharedIterationsConfig
- func (sic SharedIterationsConfig) GetDescription(et *lib.ExecutionTuple) string
- func (sic SharedIterationsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
- func (sic SharedIterationsConfig) GetIterations(et *lib.ExecutionTuple) int64
- func (sic SharedIterationsConfig) GetVUs(et *lib.ExecutionTuple) int64
- func (sic SharedIterationsConfig) HasWork(et *lib.ExecutionTuple) bool
- func (sic SharedIterationsConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
- func (sic SharedIterationsConfig) Validate() []error
- type Stage
Constants ¶
This section is empty.
Variables ¶
var DefaultGracefulStopValue = 30 * time.Second //nolint:gochecknoglobals
DefaultGracefulStopValue is the graceful top value for all executors, unless it's manually changed by the gracefulStop in each one. TODO?: Discard? Or make this actually user-configurable somehow? hello #883...
Functions ¶
func DeriveScenariosFromShortcuts ¶
DeriveScenariosFromShortcuts checks for conflicting options and turns any shortcut options (i.e. duration, iterations, stages) into the proper long-form scenario/executor configuration in the scenarios property.
Types ¶
type BaseConfig ¶
type BaseConfig struct { Name string `json:"-"` // set via the JS object key Type string `json:"executor"` StartTime types.NullDuration `json:"startTime"` GracefulStop types.NullDuration `json:"gracefulStop"` Env map[string]string `json:"env"` Exec null.String `json:"exec"` // function name, externally validated Tags map[string]string `json:"tags"` }
BaseConfig contains the common config fields for all executors
func NewBaseConfig ¶
func NewBaseConfig(name, configType string) BaseConfig
NewBaseConfig returns a default base config with the default values
func (BaseConfig) GetEnv ¶
func (bc BaseConfig) GetEnv() map[string]string
GetEnv returns any specific environment key=value pairs that are configured for the executor.
func (BaseConfig) GetExec ¶
func (bc BaseConfig) GetExec() string
GetExec returns the configured custom exec value, if any.
func (BaseConfig) GetGracefulStop ¶
func (bc BaseConfig) GetGracefulStop() time.Duration
GetGracefulStop returns how long k6 is supposed to wait for any still running iterations to finish executing at the end of the normal executor duration, before it actually kills them.
Of course, that doesn't count when the user manually interrupts the test, then iterations are immediately stopped.
func (BaseConfig) GetName ¶
func (bc BaseConfig) GetName() string
GetName returns the name of the executor.
func (BaseConfig) GetStartTime ¶
func (bc BaseConfig) GetStartTime() time.Duration
GetStartTime returns the starting time, relative to the beginning of the actual test, that this executor is supposed to execute.
func (BaseConfig) GetTags ¶
func (bc BaseConfig) GetTags() map[string]string
GetTags returns any custom tags configured for the executor.
func (BaseConfig) GetType ¶
func (bc BaseConfig) GetType() string
GetType returns the executor's type as a string ID.
func (BaseConfig) IsDistributable ¶
func (bc BaseConfig) IsDistributable() bool
IsDistributable returns true since by default all executors could be run in a distributed manner.
func (BaseConfig) Validate ¶
func (bc BaseConfig) Validate() (errors []error)
Validate checks some basic things like present name, type, and a positive start time
type BaseExecutor ¶
type BaseExecutor struct {
// contains filtered or unexported fields
}
BaseExecutor is a helper struct that contains common properties and methods between most executors. It is intended to be used as an anonymous struct inside of most of the executors, for the purpose of reducing boilerplate code.
func NewBaseExecutor ¶
func NewBaseExecutor(config lib.ExecutorConfig, es *lib.ExecutionState, logger *logrus.Entry) *BaseExecutor
NewBaseExecutor returns an initialized BaseExecutor
func (BaseExecutor) GetConfig ¶
func (bs BaseExecutor) GetConfig() lib.ExecutorConfig
GetConfig returns the configuration with which this executor was launched.
func (BaseExecutor) GetLogger ¶
func (bs BaseExecutor) GetLogger() *logrus.Entry
GetLogger returns the executor logger entry.
func (BaseExecutor) GetProgress ¶
func (bs BaseExecutor) GetProgress() *pb.ProgressBar
GetProgress just returns the progressbar pointer.
type ConstantArrivalRate ¶
type ConstantArrivalRate struct { *BaseExecutor // contains filtered or unexported fields }
ConstantArrivalRate tries to execute a specific number of iterations for a specific period.
func (*ConstantArrivalRate) Init ¶
func (car *ConstantArrivalRate) Init(ctx context.Context) error
Init values needed for the execution
func (ConstantArrivalRate) Run ¶
func (car ConstantArrivalRate) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
Run executes a constant number of iterations per second.
TODO: Split this up and make an independent component that can be reused between the constant and ramping arrival rate executors - that way we can keep the complexity in one well-architected part (with short methods and few lambdas :D), while having both config frontends still be present for maximum UX benefits. Basically, keep the progress bars and scheduling (i.e. at what time should iteration X begin) different, but keep everything else the same. This will allow us to implement https://github.com/k6io/k6/issues/1386 and things like all of the TODOs below in one place only.
type ConstantArrivalRateConfig ¶
type ConstantArrivalRateConfig struct { BaseConfig Rate null.Int `json:"rate"` TimeUnit types.NullDuration `json:"timeUnit"` Duration types.NullDuration `json:"duration"` // Initialize `PreAllocatedVUs` number of VUs, and if more than that are needed, // they will be dynamically allocated, until `MaxVUs` is reached, which is an // absolutely hard limit on the number of VUs the executor will use PreAllocatedVUs null.Int `json:"preAllocatedVUs"` MaxVUs null.Int `json:"maxVUs"` }
ConstantArrivalRateConfig stores config for the constant arrival-rate executor
func NewConstantArrivalRateConfig ¶
func NewConstantArrivalRateConfig(name string) *ConstantArrivalRateConfig
NewConstantArrivalRateConfig returns a ConstantArrivalRateConfig with default values
func (ConstantArrivalRateConfig) GetDescription ¶
func (carc ConstantArrivalRateConfig) GetDescription(et *lib.ExecutionTuple) string
GetDescription returns a human-readable description of the executor options
func (ConstantArrivalRateConfig) GetExecutionRequirements ¶
func (carc ConstantArrivalRateConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
GetExecutionRequirements returns the number of required VUs to run the executor for its whole duration (disregarding any startTime), including the maximum waiting time for any iterations to gracefully stop. This is used by the execution scheduler in its VU reservation calculations, so it knows how many VUs to pre-initialize.
func (ConstantArrivalRateConfig) GetMaxVUs ¶
func (carc ConstantArrivalRateConfig) GetMaxVUs(et *lib.ExecutionTuple) int64
GetMaxVUs is just a helper method that returns the scaled max VUs.
func (ConstantArrivalRateConfig) GetPreAllocatedVUs ¶
func (carc ConstantArrivalRateConfig) GetPreAllocatedVUs(et *lib.ExecutionTuple) int64
GetPreAllocatedVUs is just a helper method that returns the scaled pre-allocated VUs.
func (ConstantArrivalRateConfig) HasWork ¶
func (carc ConstantArrivalRateConfig) HasWork(et *lib.ExecutionTuple) bool
HasWork reports whether there is any work to be done for the given execution segment.
func (ConstantArrivalRateConfig) NewExecutor ¶
func (carc ConstantArrivalRateConfig) NewExecutor( es *lib.ExecutionState, logger *logrus.Entry, ) (lib.Executor, error)
NewExecutor creates a new ConstantArrivalRate executor
func (*ConstantArrivalRateConfig) Validate ¶
func (carc *ConstantArrivalRateConfig) Validate() []error
Validate makes sure all options are configured and valid
type ConstantVUs ¶
type ConstantVUs struct { *BaseExecutor // contains filtered or unexported fields }
ConstantVUs maintains a constant number of VUs running for the specified duration.
func (ConstantVUs) Run ¶
func (clv ConstantVUs) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
Run constantly loops through as many iterations as possible on a fixed number of VUs for the specified duration.
type ConstantVUsConfig ¶
type ConstantVUsConfig struct { BaseConfig VUs null.Int `json:"vus"` Duration types.NullDuration `json:"duration"` }
ConstantVUsConfig stores VUs and duration
func NewConstantVUsConfig ¶
func NewConstantVUsConfig(name string) ConstantVUsConfig
NewConstantVUsConfig returns a ConstantVUsConfig with default values
func (ConstantVUsConfig) GetDescription ¶
func (clvc ConstantVUsConfig) GetDescription(et *lib.ExecutionTuple) string
GetDescription returns a human-readable description of the executor options
func (ConstantVUsConfig) GetExecutionRequirements ¶
func (clvc ConstantVUsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
GetExecutionRequirements returns the number of required VUs to run the executor for its whole duration (disregarding any startTime), including the maximum waiting time for any iterations to gracefully stop. This is used by the execution scheduler in its VU reservation calculations, so it knows how many VUs to pre-initialize.
func (ConstantVUsConfig) GetVUs ¶
func (clvc ConstantVUsConfig) GetVUs(et *lib.ExecutionTuple) int64
GetVUs returns the scaled VUs for the executor.
func (ConstantVUsConfig) HasWork ¶
func (clvc ConstantVUsConfig) HasWork(et *lib.ExecutionTuple) bool
HasWork reports whether there is any work to be done for the given execution segment.
func (ConstantVUsConfig) NewExecutor ¶
func (clvc ConstantVUsConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
NewExecutor creates a new ConstantVUs executor
func (ConstantVUsConfig) Validate ¶
func (clvc ConstantVUsConfig) Validate() []error
Validate makes sure all options are configured and valid
type ExecutionConflictError ¶
type ExecutionConflictError string
ExecutionConflictError is a custom error type used for all of the errors in the DeriveScenariosFromShortcuts() function.
func (ExecutionConflictError) Error ¶
func (e ExecutionConflictError) Error() string
type ExternallyControlled ¶
type ExternallyControlled struct { *BaseExecutor // contains filtered or unexported fields }
ExternallyControlled is an implementation of the old k6 executor that could be controlled externally, via the k6 REST API. It implements both the lib.PausableExecutor and the lib.LiveUpdatableExecutor interfaces.
func (*ExternallyControlled) GetConfig ¶
func (mex *ExternallyControlled) GetConfig() lib.ExecutorConfig
GetConfig just returns the executor's current configuration, it's basically an alias of GetCurrentConfig that implements the more generic interface.
func (*ExternallyControlled) GetCurrentConfig ¶
func (mex *ExternallyControlled) GetCurrentConfig() ExternallyControlledConfig
GetCurrentConfig just returns the executor's current configuration.
func (ExternallyControlled) GetLogger ¶
func (mex ExternallyControlled) GetLogger() *logrus.Entry
GetLogger just returns the executor's logger instance.
func (ExternallyControlled) GetProgress ¶
func (mex ExternallyControlled) GetProgress() *pb.ProgressBar
GetProgress just returns the executor's progress bar instance.
func (ExternallyControlled) Init ¶
func (mex ExternallyControlled) Init(ctx context.Context) error
Init doesn't do anything...
func (*ExternallyControlled) Run ¶
func (mex *ExternallyControlled) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
Run constantly loops through as many iterations as possible on a variable dynamically controlled number of VUs either for the specified duration, or until the test is manually stopped. nolint:funlen,gocognit
func (*ExternallyControlled) SetPaused ¶
func (mex *ExternallyControlled) SetPaused(paused bool) error
SetPaused pauses or resumes the executor.
func (*ExternallyControlled) UpdateConfig ¶
func (mex *ExternallyControlled) UpdateConfig(ctx context.Context, newConf interface{}) error
UpdateConfig validates the supplied config and updates it in real time. It is possible to update the configuration even when k6 is paused, either in the beginning (i.e. when running k6 with --paused) or in the middle of the script execution.
type ExternallyControlledConfig ¶
type ExternallyControlledConfig struct { BaseConfig ExternallyControlledConfigParams }
ExternallyControlledConfig stores the number of currently active VUs, the max number of VUs and the executor duration. The duration can be 0, which means "infinite duration", i.e. the user has to manually abort the script.
func (ExternallyControlledConfig) GetDescription ¶
func (mec ExternallyControlledConfig) GetDescription(_ *lib.ExecutionTuple) string
GetDescription returns a human-readable description of the executor options
func (ExternallyControlledConfig) GetExecutionRequirements ¶
func (mec ExternallyControlledConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
GetExecutionRequirements reserves the configured number of max VUs for the whole duration of the executor, so these VUs can be externally initialized in the beginning of the test.
Importantly, if 0 (i.e. infinite) duration is configured, this executor doesn't emit the last step to relinquish these VUs.
Also, the externally controlled executor doesn't set MaxUnplannedVUs in the returned steps, since their initialization and usage is directly controlled by the user, can be changed during the test runtime, and is effectively bounded only by the resources of the machine k6 is running on.
This is not a problem, because the MaxUnplannedVUs are mostly meant to be used for calculating the maximum possible number of initialized VUs at any point during a test run. That's used for sizing purposes and for user qouta checking in the cloud execution, where the externally controlled executor isn't supported.
func (ExternallyControlledConfig) HasWork ¶
func (mec ExternallyControlledConfig) HasWork(_ *lib.ExecutionTuple) bool
HasWork reports whether there is any work to be done for the given execution segment.
func (ExternallyControlledConfig) IsDistributable ¶
func (ExternallyControlledConfig) IsDistributable() bool
IsDistributable simply returns false because there's no way to reliably distribute the externally controlled executor.
func (ExternallyControlledConfig) NewExecutor ¶
func (mec ExternallyControlledConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
NewExecutor creates a new ExternallyControlled executor
func (ExternallyControlledConfig) Validate ¶
func (mec ExternallyControlledConfig) Validate() []error
Validate makes sure all options are configured and valid
type ExternallyControlledConfigParams ¶
type ExternallyControlledConfigParams struct { VUs null.Int `json:"vus"` Duration types.NullDuration `json:"duration"` // 0 is a valid value, meaning infinite duration MaxVUs null.Int `json:"maxVUs"` }
ExternallyControlledConfigParams contains all of the options that actually determine the scheduling of VUs in the externally controlled executor.
func (ExternallyControlledConfigParams) Validate ¶
func (mecc ExternallyControlledConfigParams) Validate() (errors []error)
Validate just checks the control options in isolation.
type PerVUIterations ¶
type PerVUIterations struct { *BaseExecutor // contains filtered or unexported fields }
PerVUIterations executes a specific number of iterations with each VU.
func (PerVUIterations) Run ¶
func (pvi PerVUIterations) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
Run executes a specific number of iterations with each configured VU. nolint:funlen
type PerVUIterationsConfig ¶
type PerVUIterationsConfig struct { BaseConfig VUs null.Int `json:"vus"` Iterations null.Int `json:"iterations"` MaxDuration types.NullDuration `json:"maxDuration"` }
PerVUIterationsConfig stores the number of VUs iterations, as well as maxDuration settings
func NewPerVUIterationsConfig ¶
func NewPerVUIterationsConfig(name string) PerVUIterationsConfig
NewPerVUIterationsConfig returns a PerVUIterationsConfig with default values
func (PerVUIterationsConfig) GetDescription ¶
func (pvic PerVUIterationsConfig) GetDescription(et *lib.ExecutionTuple) string
GetDescription returns a human-readable description of the executor options
func (PerVUIterationsConfig) GetExecutionRequirements ¶
func (pvic PerVUIterationsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
GetExecutionRequirements returns the number of required VUs to run the executor for its whole duration (disregarding any startTime), including the maximum waiting time for any iterations to gracefully stop. This is used by the execution scheduler in its VU reservation calculations, so it knows how many VUs to pre-initialize.
func (PerVUIterationsConfig) GetIterations ¶
func (pvic PerVUIterationsConfig) GetIterations() int64
GetIterations returns the UNSCALED iteration count for the executor. It's important to note that scaling per-VU iteration executor affects only the number of VUs. If we also scaled the iterations, scaling would have quadratic effects instead of just linear.
func (PerVUIterationsConfig) GetVUs ¶
func (pvic PerVUIterationsConfig) GetVUs(et *lib.ExecutionTuple) int64
GetVUs returns the scaled VUs for the executor.
func (PerVUIterationsConfig) HasWork ¶
func (pvic PerVUIterationsConfig) HasWork(et *lib.ExecutionTuple) bool
HasWork reports whether there is any work to be done for the given execution segment.
func (PerVUIterationsConfig) NewExecutor ¶
func (pvic PerVUIterationsConfig) NewExecutor( es *lib.ExecutionState, logger *logrus.Entry, ) (lib.Executor, error)
NewExecutor creates a new PerVUIterations executor
func (PerVUIterationsConfig) Validate ¶
func (pvic PerVUIterationsConfig) Validate() []error
Validate makes sure all options are configured and valid
type RampingArrivalRate ¶
type RampingArrivalRate struct { *BaseExecutor // contains filtered or unexported fields }
RampingArrivalRate tries to execute a specific number of iterations for a specific period. TODO: combine with the ConstantArrivalRate?
func (RampingArrivalRate) Run ¶
func (varr RampingArrivalRate) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
Run executes a variable number of iterations per second.
TODO: Split this up and make an independent component that can be reused between the constant and ramping arrival rate executors - that way we can keep the complexity in one well-architected part (with short methods and few lambdas :D), while having both config frontends still be present for maximum UX benefits. Basically, keep the progress bars and scheduling (i.e. at what time should iteration X begin) different, but keep everyhing else the same. This will allow us to implement https://github.com/k6io/k6/issues/1386 and things like all of the TODOs below in one place only.
type RampingArrivalRateConfig ¶
type RampingArrivalRateConfig struct { BaseConfig StartRate null.Int `json:"startRate"` TimeUnit types.NullDuration `json:"timeUnit"` Stages []Stage `json:"stages"` // Initialize `PreAllocatedVUs` number of VUs, and if more than that are needed, // they will be dynamically allocated, until `MaxVUs` is reached, which is an // absolutely hard limit on the number of VUs the executor will use PreAllocatedVUs null.Int `json:"preAllocatedVUs"` MaxVUs null.Int `json:"maxVUs"` }
RampingArrivalRateConfig stores config for the ramping (i.e. variable) arrival-rate executor.
func NewRampingArrivalRateConfig ¶
func NewRampingArrivalRateConfig(name string) *RampingArrivalRateConfig
NewRampingArrivalRateConfig returns a RampingArrivalRateConfig with default values
func (RampingArrivalRateConfig) GetDescription ¶
func (varc RampingArrivalRateConfig) GetDescription(et *lib.ExecutionTuple) string
GetDescription returns a human-readable description of the executor options
func (RampingArrivalRateConfig) GetExecutionRequirements ¶
func (varc RampingArrivalRateConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
GetExecutionRequirements returns the number of required VUs to run the executor for its whole duration (disregarding any startTime), including the maximum waiting time for any iterations to gracefully stop. This is used by the execution scheduler in its VU reservation calculations, so it knows how many VUs to pre-initialize.
func (RampingArrivalRateConfig) GetMaxVUs ¶
func (varc RampingArrivalRateConfig) GetMaxVUs(et *lib.ExecutionTuple) int64
GetMaxVUs is just a helper method that returns the scaled max VUs.
func (RampingArrivalRateConfig) GetPreAllocatedVUs ¶
func (varc RampingArrivalRateConfig) GetPreAllocatedVUs(et *lib.ExecutionTuple) int64
GetPreAllocatedVUs is just a helper method that returns the scaled pre-allocated VUs.
func (RampingArrivalRateConfig) HasWork ¶
func (varc RampingArrivalRateConfig) HasWork(et *lib.ExecutionTuple) bool
HasWork reports whether there is any work to be done for the given execution segment.
func (RampingArrivalRateConfig) NewExecutor ¶
func (varc RampingArrivalRateConfig) NewExecutor( es *lib.ExecutionState, logger *logrus.Entry, ) (lib.Executor, error)
NewExecutor creates a new RampingArrivalRate executor
func (*RampingArrivalRateConfig) Validate ¶
func (varc *RampingArrivalRateConfig) Validate() []error
Validate makes sure all options are configured and valid
type RampingVUs ¶
type RampingVUs struct { *BaseExecutor // contains filtered or unexported fields }
RampingVUs handles the old "stages" execution configuration - it loops iterations with a variable number of VUs for the sum of all of the specified stages' duration.
func (RampingVUs) Run ¶
func (vlv RampingVUs) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
Run constantly loops through as many iterations as possible on a variable number of VUs for the specified stages.
TODO: split up? since this does a ton of things, unfortunately I can't think of a less complex way to implement it (besides the old "increment by 100ms and see what happens)... :/ so maybe see how it can be split? nolint:funlen,gocognit
type RampingVUsConfig ¶
type RampingVUsConfig struct { BaseConfig StartVUs null.Int `json:"startVUs"` Stages []Stage `json:"stages"` GracefulRampDown types.NullDuration `json:"gracefulRampDown"` }
RampingVUsConfig stores the configuration for the stages executor
func NewRampingVUsConfig ¶
func NewRampingVUsConfig(name string) RampingVUsConfig
NewRampingVUsConfig returns a RampingVUsConfig with its default values
func (RampingVUsConfig) GetDescription ¶
func (vlvc RampingVUsConfig) GetDescription(et *lib.ExecutionTuple) string
GetDescription returns a human-readable description of the executor options
func (RampingVUsConfig) GetExecutionRequirements ¶
func (vlvc RampingVUsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
GetExecutionRequirements very dynamically reserves exactly the number of required VUs for this executor at every moment of the test.
If gracefulRampDown is specified, it will also be taken into account, and the number of needed VUs to handle that will also be reserved. See the documentation of reserveVUsForGracefulRampDowns() for more details.
On the other hand, gracefulStop is handled here. To facilitate it, we'll ensure that the last execution step will have 0 VUs and will be at time offset (sum(stages.Duration)+gracefulStop). Any steps that would've been added after it will be ignored. Thus:
- gracefulStop can be less than gracefulRampDown and can cut the graceful ramp-down periods of the last VUs short.
- gracefulRampDown can be more than gracefulStop:
- If the user manually ramped down VUs at the end of the test (i.e. the last stage's target is 0), then this will have no effect.
- If the last stage's target is more than 0, the VUs at the end of the executor's life will have more time to finish their last iterations.
func (RampingVUsConfig) GetGracefulRampDown ¶
func (vlvc RampingVUsConfig) GetGracefulRampDown() time.Duration
GetGracefulRampDown is just a helper method that returns the graceful ramp-down period as a standard Go time.Duration value...
func (RampingVUsConfig) GetStartVUs ¶
func (vlvc RampingVUsConfig) GetStartVUs(et *lib.ExecutionTuple) int64
GetStartVUs is just a helper method that returns the scaled starting VUs.
func (RampingVUsConfig) HasWork ¶
func (vlvc RampingVUsConfig) HasWork(et *lib.ExecutionTuple) bool
HasWork reports whether there is any work to be done for the given execution segment.
func (RampingVUsConfig) NewExecutor ¶
func (vlvc RampingVUsConfig) NewExecutor(es *lib.ExecutionState, logger *logrus.Entry) (lib.Executor, error)
NewExecutor creates a new RampingVUs executor
func (RampingVUsConfig) Validate ¶
func (vlvc RampingVUsConfig) Validate() []error
Validate makes sure all options are configured and valid
type SharedIterations ¶
type SharedIterations struct { // contains filtered or unexported fields }
SharedIterations executes a specific total number of iterations, which are all shared by the configured VUs.
func (*SharedIterations) Init ¶
func (si *SharedIterations) Init(ctx context.Context) error
Init values needed for the execution
func (SharedIterations) Run ¶
func (si SharedIterations) Run(parentCtx context.Context, out chan<- stats.SampleContainer) (err error)
Run executes a specific total number of iterations, which are all shared by the configured VUs. nolint:funlen
type SharedIterationsConfig ¶
type SharedIterationsConfig struct {}
SharedIterationsConfig stores the number of VUs iterations, as well as maxDuration settings
func NewSharedIterationsConfig ¶
func NewSharedIterationsConfig(name string) SharedIterationsConfig
NewSharedIterationsConfig returns a SharedIterationsConfig with default values
func (SharedIterationsConfig) GetDescription ¶
func (sic SharedIterationsConfig) GetDescription(et *lib.ExecutionTuple) string
GetDescription returns a human-readable description of the executor options
func (SharedIterationsConfig) GetExecutionRequirements ¶
func (sic SharedIterationsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep
GetExecutionRequirements returns the number of required VUs to run the executor for its whole duration (disregarding any startTime), including the maximum waiting time for any iterations to gracefully stop. This is used by the execution scheduler in its VU reservation calculations, so it knows how many VUs to pre-initialize.
func (SharedIterationsConfig) GetIterations ¶
func (sic SharedIterationsConfig) GetIterations(et *lib.ExecutionTuple) int64
GetIterations returns the scaled iteration count for the executor.
func (SharedIterationsConfig) GetVUs ¶
func (sic SharedIterationsConfig) GetVUs(et *lib.ExecutionTuple) int64
GetVUs returns the scaled VUs for the executor.
func (SharedIterationsConfig) HasWork ¶
func (sic SharedIterationsConfig) HasWork(et *lib.ExecutionTuple) bool
HasWork reports whether there is any work to be done for the given execution segment.
func (SharedIterationsConfig) NewExecutor ¶
func (sic SharedIterationsConfig) NewExecutor( es *lib.ExecutionState, logger *logrus.Entry, ) (lib.Executor, error)
NewExecutor creates a new SharedIterations executor
func (SharedIterationsConfig) Validate ¶
func (sic SharedIterationsConfig) Validate() []error
Validate makes sure all options are configured and valid
type Stage ¶
type Stage struct { Duration types.NullDuration `json:"duration"` Target null.Int `json:"target"` // TODO: maybe rename this to endVUs? something else? }
Stage contains