Behaviours: sregulator_valve.
Implements a valve which increases its size when an update is below a target.
sregulator_relative_value
can be used as the sregulator_valve
in a
sregulator
. It will provide a valve that increases in size when an update
is below a target valve between the minimum and maximum capacity. Its
argument, spec()
, is of the form:
#{target => Target :: integer(), % default: 100 min => Min :: non_neg_integer(), % default: 0 max => Max :: non_neg_integer() | infinity} % default: infinity
Target
is the target relative value in milliseconds (defaults to 100
).
The valve will open when an update below the target (in native
time units)
is received if between the the minimum, Min
(defaults to 0
), and the
maximum, Max
(defaults to infinity
). Once opened by an update the valve
remains open until the concurrency level increases by 1 or an update greater
than the target is received. The valve is always open when below the minimum
and always closed once it reaches the maximum.
This valve tries to enforce a minimum level of concurrency and will grow
while a relevant sbroker_queue
is moving quickly - up to a maximum.
Therefore this valve expects the updates to be from a
sregulator_update_meter
.
By using a positive target RelativeTime
of an sbroker
queue, a pool of
workers can grow before the queue is empty. Therefore preventing or delaying
the situation where the counter party client processes have to wait for a
worker.
RelativeTime
of an sbroker
queue, a pool of
expensive resources can delay growth until required.
spec() = #{target => Target::integer(), min => Min::non_neg_integer(), max => Max::non_neg_integer() | infinity}
Generated by EDoc