LiveLoad.Scenario.Throttle.Interarrival (LiveLoad v0.0.1-rc.58)

Copy Markdown View Source

LiveLoad.Scenario.Throttle.Interarrival provides a rate limiter which enforces a set amount of time between events.

Examples

# One event every 500 milliseconds
LiveLoad.Scenario.Throttle.Interarrival.new(:my_throttle, to_timeout(millisecond: 500))

# One event every 2 seconds
LiveLoad.Scenario.Throttle.Interarrival.new(:my_throttle, to_timeout(second: 2))

# Start at 1 event per second and ramp up over the next 2 minutes
LiveLoad.Scenario.Throttle.Interarrival.new(:my_throttle, to_timeout(second: 1))
|> LiveLoad.Scenario.Throttle.Interarrival.ramp(100, duration: to_timeout(minute: 2))

Summary

Functions

Creates a new LiveLoad.Scenario.Throttle.Interarrival with the given name and time between events.

Attaches a gradually ramping interarrival change to the throttle.

Types

t()

@opaque t()

time_between()

@type time_between() :: pos_integer()

Functions

new(name, time_between)

@spec new(name :: atom(), time_between :: time_between()) :: t()

Creates a new LiveLoad.Scenario.Throttle.Interarrival with the given name and time between events.

ramp(interarrival, target, opts)

@spec ramp(
  interarrival :: t(),
  target :: LiveLoad.Scenario.Throttle.Ramp.target(),
  ramp_opts :: [LiveLoad.Scenario.Throttle.Ramp.option()]
) :: t()

Attaches a gradually ramping interarrival change to the throttle.

Target defines the target interarrival in milliseconds.

Options

  • :duration: The duration of the gradual ramp up in milliseconds
  • :steps: The number of steps to take while ramping up. Requires an :interval value.
  • :interval: The interval at which to take each step. Requires a :step value.