Documentation
¶
Overview ¶
Package bench is an open-loop HTTP load driver with failure-window analysis.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Percentile ¶
Percentile returns the nearest-rank percentile (0 < p <= 100) of sorted.
Types ¶
type Config ¶
type Config struct {
URL string
Rate float64
Duration time.Duration
Timeout time.Duration
MaxInFlight int
}
Config describes one constant-arrival-rate run.
type EventReport ¶
type EventReport struct {
Name string `json:"name"`
FiredAtMS float64 `json:"fired_at_ms"`
FireError string `json:"fire_error,omitempty"`
Dropped int `json:"dropped_requests"`
FirstErrorMS float64 `json:"first_error_ms"`
ErrorWindowMS float64 `json:"error_window_ms"`
RecoveryMS float64 `json:"recovery_ms"`
Recovered bool `json:"recovered"`
}
EventReport is the failure analysis for one fired event.
func AnalyzeEvent ¶
func AnalyzeEvent(samples []Sample, eventAt, runLen, tail time.Duration) EventReport
AnalyzeEvent measures the failures at or after eventAt. A run counts as recovered when its last failure is more than tail before the run ends.
type Overhead ¶
type Overhead struct {
P50MS float64 `json:"p50_ms"`
P95MS float64 `json:"p95_ms"`
P99MS float64 `json:"p99_ms"`
}
Overhead is the latency a proxied path adds over a direct one, in milliseconds.
type Result ¶
type Result struct {
Stats Stats `json:"stats"`
Event *EventReport `json:"event,omitempty"`
Sample []Sample `json:"-"`
}
Result is the outcome of Run.
type Stats ¶
type Stats struct {
Sent int `json:"sent"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Saturated int `json:"client_saturated"`
AchievedRPS float64 `json:"achieved_rps"`
ErrorRate float64 `json:"error_rate"`
P50MS float64 `json:"p50_ms"`
P95MS float64 `json:"p95_ms"`
P99MS float64 `json:"p99_ms"`
MaxMS float64 `json:"max_ms"`
}
Stats summarises a run. Latencies are milliseconds measured from the intended send time.
func RunClosed ¶
func RunClosed(ctx context.Context, d Doer, url string, workers int, duration, timeout time.Duration) (Stats, error)
RunClosed drives url with a fixed number of workers, each sending its next request when the previous one returns. It measures capacity at a given concurrency, not latency under a fixed arrival rate (use Run for that).