class
Cryload::RateLimiter
- Cryload::RateLimiter
- Reference
- Object
Overview
Open-loop pacer: slots are reserved on an absolute schedule anchored to the benchmark start, so the requested rate is a constant arrival rate rather than a per-worker throttle.
The schedule is never re-anchored to "now". v5 clamped the next slot to the current time, so when every worker blocked on a stalled target nobody advanced the schedule and the missed slots were erased: the run silently issued fewer requests than asked for and the outage never showed up in the percentiles. Keeping the schedule monotonic turns that backlog into measurable send delay, which is what corrected latency is computed from.
Defined in:
cryload/rate_limiter.crConstructors
Class Method Summary
-
.interval_ns_for(rate : Float64) : Int64
Shared by the limiter and by the report, so the number of slots the schedule hands out is computed exactly one way.
-
.scheduled_count(rate : Float64, span : Time::Span) : Int64
Slots the schedule hands out over
span, counting the slot at offset 0.
Instance Method Summary
-
#acquire(deadline : Time::Instant | Nil = nil) : Time::Instant | Nil
Reserves the next slot and sleeps until it is due.
- #interval_ns : Int64
- #reference : Time::Instant
Constructor Detail
Class Method Detail
Shared by the limiter and by the report, so the number of slots the schedule hands out is computed exactly one way.
Slots the schedule hands out over span, counting the slot at offset 0.
Instance Method Detail
Reserves the next slot and sleeps until it is due. Returns the instant the
request was scheduled for, which is the baseline for corrected latency,
or nil when the reserved slot falls at or past deadline (run is over).