Package org.mockserver.load
Class LoadProfile
java.lang.Object
org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
org.mockserver.model.ObjectWithJsonToString
org.mockserver.load.LoadProfile
The load profile of a
LoadScenario: an ordered list of LoadStages the orchestrator
runs in sequence. Each stage holds or ramps a setpoint — concurrent virtual users
(closed model, LoadStageType.VU), an arrival rate in iterations/second (open model,
LoadStageType.RATE), or no load at all (LoadStageType.PAUSE) — for its
durationMillis, optionally shaped by a RampCurve.
The total run duration is the sum of the stage durations; the orchestrator advances stage by
stage and ends after the last one (or when maxRequests is hit, or on stop). Per-stage
setpoint functions (LoadStage.targetVusAt(long) / LoadStage.targetRateAt(long)) are
pure and deterministic so ramp progression is unit-testable without driving traffic.
A profile may instead carry a declarative LoadShape (a named SPIKE / STAIRS / RAMP_HOLD
pattern). When a shape is set and no explicit stages are present,
getStages() returns the stages expanded from the shape — so the
orchestrator, which only ever calls getStages(), needs no change. Explicit stages always
win: if both are set the shape is ignored.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LoadProfileconstant(int vus, long durationMillis) Convenience: a single constant-VU stage.static LoadProfileconstantRate(double rate, long durationMillis) Convenience: a single constant arrival-rate (iterations/second) stage.The explicit stages exactly as set (never the shape expansion) — used by serialization.getShape()The ordered stages the orchestrator runs.static LoadProfilelinear(int startVus, int endVus, long durationMillis) Convenience: a single linear VU ramp stage.static LoadProfilestatic LoadProfiledoublepeakRate()The maximum arrival rate any stage requests, used to enforce the rate hard cap up-front.intpeakVus()The maximum VU count any stage requests, used to enforce the VU hard cap up-front.static LoadProfileConvenience: a named load shape.longSum of all stage durations — the total run length (reflects the shape expansion).withStages(List<LoadStage> stages) withStages(LoadStage... stages) Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
equals, fieldsExcludedFromEqualsAndHashCode, hashCode
-
Constructor Details
-
LoadProfile
public LoadProfile()
-
-
Method Details
-
loadProfile
-
of
-
constant
Convenience: a single constant-VU stage. -
linear
Convenience: a single linear VU ramp stage. -
constantRate
Convenience: a single constant arrival-rate (iterations/second) stage. -
shaped
Convenience: a named load shape. -
getStages
The ordered stages the orchestrator runs. Explicitstagesalways win; otherwise, when ashapeis set, this returns itsexpansion(computed once and cached). With neither, this is the (empty) explicit stages list. -
getRawStages
The explicit stages exactly as set (never the shape expansion) — used by serialization. -
getShape
-
withShape
-
withStages
-
withStages
-
addStage
-
totalDurationMillis
public long totalDurationMillis()Sum of all stage durations — the total run length (reflects the shape expansion). -
peakVus
public int peakVus()The maximum VU count any stage requests, used to enforce the VU hard cap up-front. -
peakRate
public double peakRate()The maximum arrival rate any stage requests, used to enforce the rate hard cap up-front.
-