Documentation
¶
Index ¶
- type AdaptiveConfig
- type Engine
- func New(phases []scheduler.Phase, scenario func(context.Context) (int, error), ...) *Engine
- func NewWithOptions(phases []scheduler.Phase, scenario func(context.Context) (int, error), ...) *Engine
- func NewWithSaturationPolicy(phases []scheduler.Phase, scenario func(context.Context) (int, error), ...) *Engine
- type Options
- type SaturationPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdaptiveConfig ¶ added in v0.5.0
type AdaptiveConfig struct {
// MaxErrorRate is the error rate [0,1] above which RPS is reduced.
// Zero disables error-rate-based tuning.
MaxErrorRate float64
// MaxP99 is the P99 latency threshold above which RPS is reduced.
// Zero disables P99-based tuning.
MaxP99 time.Duration
// StepDown is the multiplier applied when a threshold is breached (e.g.
// 0.9 reduces RPS by 10%). Must be in (0,1); defaults to 0.9.
StepDown float64
// StepUp is the multiplier applied when all thresholds are met (e.g.
// 1.05 increases RPS by 5%). Must be > 1; defaults to 1.05.
StepUp float64
// MinRPS is the floor for the auto-tuned rate. Defaults to 1.
MinRPS int
// MaxRPS is the ceiling for the auto-tuned rate. 0 means uncapped.
MaxRPS int
}
AdaptiveConfig enables real-time RPS auto-tuning for PhaseTypeConstant phases. On each reporting interval the engine measures observed error rate and P99 latency and adjusts the arrival rate up or down accordingly. Requires engine.Options.ReportInterval > 0 to take effect.
func (AdaptiveConfig) IsZero ¶ added in v0.5.0
func (a AdaptiveConfig) IsZero() bool
IsZero reports whether the config contains no adaptive tuning triggers.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine executes a test definition.
func New ¶
func New(phases []scheduler.Phase, scenario func(context.Context) (int, error), maxConcurrency int) *Engine
New creates an engine for the given execution inputs. It retains the legacy blocking behavior. Use NewWithSaturationPolicy for an explicit policy.
func NewWithOptions ¶ added in v0.4.0
func NewWithOptions(phases []scheduler.Phase, scenario func(context.Context) (int, error), options Options) *Engine
NewWithOptions creates an engine with explicit execution settings.
type Options ¶ added in v0.4.0
type Options struct {
MaxConcurrency int
Saturation SaturationPolicy
ReportInterval time.Duration
// OnLiveSnapshot, when non-nil, is called at the end of each reporting
// interval with the metrics observed during that window. It is invoked
// from a background goroutine and must not block. Only active when
// ReportInterval > 0.
OnLiveSnapshot func(metrics.Snapshot)
// Adaptive, when non-zero, enables real-time RPS auto-tuning for
// PhaseTypeConstant phases. Requires ReportInterval > 0.
Adaptive AdaptiveConfig
}
Options contains execution settings for Engine.
type SaturationPolicy ¶ added in v0.4.0
type SaturationPolicy string
SaturationPolicy controls what happens when all execution slots are in use.
const ( // SaturationPolicyDrop preserves the configured arrival rate by discarding // arrivals that cannot start immediately. SaturationPolicyDrop SaturationPolicy = "drop" // SaturationPolicyBlock waits for capacity, applying backpressure to the // scheduler. This preserves the behavior of earlier Pulse versions. SaturationPolicyBlock SaturationPolicy = "block" )