Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ Nothing is installed system-wide. Existing Pitot services and data directories a

The default topology is 8 workers per process at 2,500 items/s per worker with 1,000-item OTLP batches. A mixed step launches the same topology independently for traces, logs, and metrics. Without read load, the sustained proof reruns the mixed topology with the highest **accepted** throughput. With `--query-rate`, it chooses the highest-throughput topology that also completed at least 95% of the requested reads with no errors or scheduler shedding. If no sweep point qualifies, it repeats the best read-completion point and fails the sustained-read quality gate rather than publishing a write-only peak as mixed capacity. Both reports record the selected sustained process count per signal. The wider publish sweep adds independent exporters to get past telemetrygen's per-process limits; see [the source analysis](docs/telemetrygen.md).

Read cost grows with retained data, so reads measured against a nearly empty server are optimistic. `--prefill 10m` runs an ingest-only mixed phase after warmup at `--prefill-processes` per signal (default 16, using the preset's workers and rate). The runner then waits for the exported ingest queue, rollup backlog and read-cache pending-batch gauges to read zero in two consecutive scrapes, for up to the prefill duration and at least 10 minutes, since a fast prefill compresses hours of ingest. Prefill rows are excluded from totals, peaks and topology selection. The `prefill-settled` gate fails when the backlog does not drain or the gauges are missing. The sustained phase likewise starts only after the same gauges drain (up to 10 minutes), because the sweep's overload points leave backlog behind; the `sustained-settled` gate reports that wait.

The sustained phase normally reuses the mixed sweep topology with the highest accepted throughput, which can leave the host saturated. `--sustained-rate 48000` instead offers a fixed mixed rate (one process per signal, the per-worker rate scaled to match), so reads are measured at a stated ingest load.

For publication runs, dedicate the default ccx33 to Pitot and use the separate ccx33 for generators, with three repetitions. Run ingest-only and read-under-write as two groups sharing the same fresh pair of VMs; see [the publication commands](docs/publishing.md#publication-runs). For example:

```sh
Expand Down
6 changes: 6 additions & 0 deletions cmd/pitot-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func commonFlags(name string, args []string) (bench.Config, error) {
fs.IntVar(&cfg.WorkerOverride, "workers", 0, "override workers per telemetrygen process")
fs.Float64Var(&cfg.RateOverride, "rate", 0, "override items/s per telemetrygen worker")
fs.DurationVar(&cfg.DurationOverride, "duration", 0, "override every measurement duration (use for diagnostics)")
fs.DurationVar(&cfg.Prefill, "prefill", 0, "ingest-only mixed load run after warmup so measured phases start on a populated server")
fs.IntVar(&cfg.PrefillProcesses, "prefill-processes", 16, "process count per signal for the prefill phase")
fs.Float64Var(&cfg.SustainedRate, "sustained-rate", 0, "fixed offered mixed items/s for the sustained phase instead of the best sweep topology")
if err := fs.Parse(args); err != nil {
return cfg, err
}
Expand Down Expand Up @@ -189,6 +192,9 @@ func managed(ctx context.Context, args []string) error {
fs.IntVar(&cfg.WorkerOverride, "workers", 0, "override workers per process")
fs.Float64Var(&cfg.RateOverride, "rate", 0, "override items per worker per second")
fs.DurationVar(&cfg.DurationOverride, "duration", 0, "override measurement duration")
fs.DurationVar(&cfg.Prefill, "prefill", 0, "ingest-only prefill duration")
fs.IntVar(&cfg.PrefillProcesses, "prefill-processes", 16, "prefill process count per signal")
fs.Float64Var(&cfg.SustainedRate, "sustained-rate", 0, "fixed offered mixed items/s for the sustained phase")
if err := fs.Parse(args); err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions internal/bench/managed.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ type ManagedConfig struct {
WorkerOverride int
RateOverride float64
DurationOverride time.Duration
Prefill time.Duration
PrefillProcesses int
SustainedRate float64
}

var setupTokenPattern = regexp.MustCompile(`setup_token=([^\s]+)`)
Expand Down Expand Up @@ -255,6 +258,7 @@ func managedRunnerConfig(managed ManagedConfig, httpAddr, dataDir string) Config
QueryRate: managed.QueryRate, SameHost: managed.GeneratorSSH == "", TelemetrygenVersion: managed.TelemetrygenVersion,
ProcessOverride: managed.ProcessOverride, WorkerOverride: managed.WorkerOverride,
RateOverride: managed.RateOverride, DurationOverride: managed.DurationOverride,
Prefill: managed.Prefill, PrefillProcesses: managed.PrefillProcesses, SustainedRate: managed.SustainedRate,
}
cfg.GeneratorSSH = managed.GeneratorSSH
cfg.GeneratorSSHPort = managed.GeneratorSSHPort
Expand Down
21 changes: 21 additions & 0 deletions internal/bench/preset.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ func Plan(cfg Config) ([]PhaseSpec, error) {
}
}
phases := []PhaseSpec{makePhase("warmup", "warmup", Mixed, s.warmup, 1, 1)}
if cfg.Prefill < 0 {
return nil, fmt.Errorf("prefill must not be negative")
}
if cfg.Prefill > 0 {
if cfg.PrefillProcesses <= 0 {
return nil, fmt.Errorf("prefill processes must be positive")
}
// Read cost scales with retained data, so a read gate measured on a
// nearly empty server is optimistic. Prefill populates the store
// without read load before any measured phase.
phases = append(phases, makePhase("prefill", "prefill", Mixed, cfg.Prefill, cfg.PrefillProcesses, 1))
}
for repetition := 1; repetition <= cfg.Repeat; repetition++ {
for _, signal := range Signals {
if cfg.SignalSelection == "mixed" {
Expand All @@ -88,6 +100,15 @@ func Plan(cfg Config) ([]PhaseSpec, error) {
// mixed throughput from the sweep, then prove it over a longer window.
sustained := makePhase("mixed-sustained", "sustained", Mixed, s.sustain, 0, 1)
sustained.QueryRate = cfg.QueryRate
if cfg.SustainedRate < 0 {
return nil, fmt.Errorf("sustained rate must not be negative")
}
if cfg.SustainedRate > 0 {
// A fixed target rate measures reads at a stated ingest load rather
// than at whatever the sweep found the host could absorb.
sustained.ProcessesPerSignal = 1
sustained.RatePerWorker = cfg.SustainedRate / float64(len(Signals)*s.workers)
}
phases = append(phases, sustained)
return phases, nil
}
90 changes: 90 additions & 0 deletions internal/bench/preset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bench

import (
"slices"
"strings"
"testing"
"time"
)
Expand Down Expand Up @@ -93,6 +94,20 @@ func TestOverridesProduceOneDiagnosticTopology(t *testing.T) {
}
}

func TestSustainedRatePinsTheSustainedPhase(t *testing.T) {
plan, err := Plan(Config{Preset: "publish", Repeat: 1, BatchSize: 1000, QueryRate: 20, SustainedRate: 48000})
if err != nil {
t.Fatal(err)
}
p := plan[len(plan)-1]
if p.Kind != "sustained" || p.ProcessesPerSignal != 1 || p.OfferedPerSecond() != 48000 || p.QueryRate != 20 {
t.Fatalf("sustained phase not pinned: %+v offered=%v", p, p.OfferedPerSecond())
}
if _, err := Plan(Config{Preset: "publish", Repeat: 1, BatchSize: 1000, SustainedRate: -1}); err == nil {
t.Fatal("negative sustained rate accepted")
}
}

func TestLocalPlanKeepsPublishShapeOnUpperSweepPoints(t *testing.T) {
plan, err := Plan(Config{Preset: "local", Repeat: 1, BatchSize: 1000})
if err != nil {
Expand Down Expand Up @@ -181,3 +196,78 @@ func TestValidationUsesPublishShape(t *testing.T) {
t.Fatal("validate early stop disabled")
}
}

func TestPlanPrefillRunsAfterWarmupWithoutReads(t *testing.T) {
plan, err := Plan(Config{Preset: "publish", Repeat: 1, BatchSize: 1000, QueryRate: 20, SignalSelection: "mixed", Prefill: 10 * time.Minute, PrefillProcesses: 16})
if err != nil {
t.Fatal(err)
}
if p := plan[1]; p.Kind != "prefill" || p.Signal != Mixed || p.Duration != 10*time.Minute || p.ProcessesPerSignal != 16 || p.QueryRate != 0 {
t.Fatalf("prefill phase: %+v", p)
}
if _, err := Plan(Config{Preset: "quick", Repeat: 1, BatchSize: 1000, Prefill: time.Minute}); err == nil {
t.Fatal("prefill without processes accepted")
}
if _, err := Plan(Config{Preset: "quick", Repeat: 1, BatchSize: 1000, Prefill: -time.Minute, PrefillProcesses: 1}); err == nil {
t.Fatal("negative prefill accepted")
}
off := settingsFrom(Config{Preset: "publish", PrefillProcesses: 16})
on := settingsFrom(Config{Preset: "publish", Prefill: time.Minute, PrefillProcesses: 16})
if off.PrefillProcesses != 0 || workloadHash(off, nil) == workloadHash(on, nil) {
t.Fatalf("prefill missing from workload identity: %+v %+v", off, on)
}
cfg := Config{Host: "root@h", Preset: "publish", Prefill: time.Minute, PrefillProcesses: 16}
if cmd := managedRemoteCommand("/s", cfg, "v", "a"); !strings.Contains(cmd, "'--prefill' '1m0s' '--prefill-processes' '16'") {
t.Fatalf("remote command: %s", cmd)
}
if cmd := reproductionRunCommand(cfg); !strings.Contains(cmd, "--prefill 1m0s --prefill-processes 16") {
t.Fatalf("reproduction: %s", cmd)
}
if got := managedRunnerConfig(ManagedConfig{Prefill: time.Minute, PrefillProcesses: 16}, "h:1", "d"); got.Prefill != time.Minute || got.PrefillProcesses != 16 {
t.Fatalf("managed config: %+v", got)
}
}

func TestSummarizeGatesPrefillSettling(t *testing.T) {
trial := func(kind string, unsettled bool) Trial {
return Trial{Spec: PhaseSpec{Name: kind, Kind: kind, Signal: Mixed}, Accepted: Counts{Spans: 100}, Unsettled: unsettled}
}
for _, unsettled := range []bool{false, true} {
report := Report{Trials: []Trial{trial("prefill", unsettled), trial("sustained", false)}}
s := summarize(report, 0, 0)
if s.Accepted.Spans != 100 {
t.Fatalf("prefill rows counted in totals: %v", s.Accepted.Spans)
}
var found bool
for _, g := range s.Gates {
if g.Name == "prefill-settled" {
found = true
if g.Passed == unsettled {
t.Fatalf("gate %+v for unsettled=%v", g, unsettled)
}
}
}
if !found || s.Passed == unsettled {
t.Fatalf("unsettled=%v passed=%v found=%v", unsettled, s.Passed, found)
}
}
}

func TestSummarizeGatesSustainedSettling(t *testing.T) {
for _, unsettled := range []bool{false, true} {
report := Report{Trials: []Trial{{Spec: PhaseSpec{Name: "mixed-sustained", Kind: "sustained", Signal: Mixed}, Accepted: Counts{Spans: 100}, Unsettled: unsettled}}}
s := summarize(report, 0, 0)
var found bool
for _, g := range s.Gates {
if g.Name == "sustained-settled" {
found = true
if g.Passed == unsettled {
t.Fatalf("gate %+v for unsettled=%v", g, unsettled)
}
}
}
if !found || (unsettled && s.Passed) {
t.Fatalf("unsettled=%v passed=%v found=%v", unsettled, s.Passed, found)
}
}
}
2 changes: 1 addition & 1 deletion internal/bench/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ func managedRemoteCommand(stage string, cfg Config, version, artifact string) st
args = append(args, "--telemetrygen-version", cfg.TelemetrygenVersion)
args = append(args, "--provisioned-host", redactedHost(cfg.Host), "--host-description", cfg.HostDescription)
args = append(args, "--provisioned-ssh-port", fmt.Sprint(cfg.SSHPort), "--provisioned-ssh-identity", cfg.SSHIdentity)
args = append(args, "--processes", fmt.Sprint(cfg.ProcessOverride), "--workers", fmt.Sprint(cfg.WorkerOverride), "--rate", fmt.Sprint(cfg.RateOverride), "--duration", cfg.DurationOverride.String())
args = append(args, "--processes", fmt.Sprint(cfg.ProcessOverride), "--workers", fmt.Sprint(cfg.WorkerOverride), "--rate", fmt.Sprint(cfg.RateOverride), "--duration", cfg.DurationOverride.String(), "--prefill", cfg.Prefill.String(), "--prefill-processes", fmt.Sprint(cfg.PrefillProcesses), "--sustained-rate", fmt.Sprint(cfg.SustainedRate))
binaries := []string{stage + "/pitot-bench", stage + "/pitot"}
prefix := ""
if cfg.GeneratorHost == "" {
Expand Down
23 changes: 22 additions & 1 deletion internal/bench/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func Markdown(r Report) string {
for _, warning := range r.Summary.Warnings {
fmt.Fprintf(&b, "- %s\n", warning)
}
fmt.Fprintf(&b, "\n## Reproduce\n\n```sh\n%s\n```\n\nRaw evidence: `report.json` (authoritative structured report) and `samples.jsonl` (time-series resource samples, including cumulative `ingest_rows_total` by signal (`spans`, `logs`, `metrics`), `rollup_seconds`, `write_gate_hold_seconds`, `write_gate_wait_seconds`, `compaction_seconds_total`, `compactions_total`, `publish_wait_seconds_total`, `ingest_backpressure_seconds_total`, `ingest_throttled_total`, `ingest_admission_rows_per_second`, `compaction_retired_batches_total`, and `compaction_pass_seconds_total`, plus the current `compaction_backlog_batches` gauge when available).\n", r.ReproductionCommand)
fmt.Fprintf(&b, "\n## Reproduce\n\n```sh\n%s\n```\n\nRaw evidence: `report.json` (authoritative structured report) and `samples.jsonl` (time-series resource samples, including cumulative `ingest_rows_total` by signal (`spans`, `logs`, `metrics`), `rollup_seconds`, `write_gate_hold_seconds`, `write_gate_wait_seconds`, `compaction_seconds_total`, `compactions_total`, `publish_wait_seconds_total`, `ingest_backpressure_seconds_total`, `ingest_throttled_total`, `ingest_admission_rows_per_second`, `compaction_retired_batches_total`, and `compaction_pass_seconds_total`, plus the current `compaction_backlog_batches` and `read_cache_pending_batches` gauges and cumulative `rollup_rows` by rollup when available).\n", r.ReproductionCommand)
return b.String()
}

Expand Down Expand Up @@ -251,6 +251,7 @@ func reproductionRunCommand(c Config) string {
if c.DurationOverride > 0 {
parts = append(parts, "--duration "+c.DurationOverride.String())
}
parts = append(parts, loadArgs(c)...)
return strings.Join(parts, " ")
}
env := []string{"PITOT_BENCH_INGEST_TOKEN=…"}
Expand All @@ -271,9 +272,26 @@ func reproductionRunCommand(c Config) string {
env = append(env, "PITOT_BENCH_QUERY_COOKIE=…")
parts = append(parts, "--query-url "+shellQuote(c.QueryURL), "--query-rate "+fmt.Sprint(c.QueryRate))
}
parts = append(parts, loadArgs(c)...)
return strings.Join(append(env, parts...), " ")
}

// loadArgs are the phase-shaping flags both reproduction forms carry.
func loadArgs(c Config) []string {
args := prefillArgs(c)
if c.SustainedRate > 0 {
args = append(args, "--sustained-rate "+fmt.Sprint(c.SustainedRate))
}
return args
}

func prefillArgs(c Config) []string {
if c.Prefill <= 0 {
return nil
}
return []string{"--prefill " + c.Prefill.String(), "--prefill-processes " + fmt.Sprint(c.PrefillProcesses)}
}

func shellQuote(v string) string { return "'" + strings.ReplaceAll(v, "'", "'\\''") + "'" }
func phaseIcon(kind string) string {
if kind == "warmup" {
Expand All @@ -282,6 +300,9 @@ func phaseIcon(kind string) string {
if kind == "sustained" {
return "◆"
}
if kind == "prefill" {
return "▪"
}
return "◇"
}
func resultIcon(class string) string {
Expand Down
Loading
Loading