pace

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package pace sends events on a fixed schedule (an open load model).

In a closed loop, a producer that waits for each reply sends nothing while the server is stalled, so a stall shows up as a single slow sample (coordinated omission). Run keeps the schedule: every event planned during a stall still fires on time, in its own goroutine, and callers measure latency from the planned time, so the stall reaches p99 as it would for real users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Planned

func Planned(start time.Time, rate float64, i int64) time.Time

Planned is the send time of event i at rate events per second.

func Run

func Run(ctx context.Context, start time.Time, rate float64, maxInFlight int, fire func(planned time.Time)) (sent, dropped int64)

Run fires one call per planned time from start until ctx is done, never waiting for a call to return. At most maxInFlight calls run at once; an event planned while that many are still running is dropped and counted, and a run with drops is invalid (the load generator, not the server, set the pace). If Run falls behind (a slow scheduler), it fires the late events at once instead of skipping them. It returns after ctx is done and every call has returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL