Skip to content

perf(query): keep compaction, rollups and gates ahead of sustained ingest - #312

Merged
vishr merged 2 commits into
mainfrom
perf/sustained-ingest
Oct 15, 2026
Merged

vishr merged 2 commits into
mainfrom
perf/sustained-ingest

Conversation

@vishr

@vishr vishr commented Oct 15, 2026

Copy link
Copy Markdown
Member

What changed

On a 32-vCPU host at 478k items/s (fanout-bench publish preset, generators on a separate host), Parquet files grew from 3,038 to 17,251 in five minutes, DuckDB native memory swung up to 31 GiB during ingest-only load while the Go heap stayed under 2 GiB, and version-rollup and anomaly writes timed out on the write gate.

  • Edge rollup: the parent hash table held every span within an hour of the affected minute. It now semi-joins parents against the distinct traces of the affected children, keeping the one-hour range and identical call edges, so the build side no longer grows with ingest rate.
  • Compaction cadence: the next cycle starts after 100 ms while cycles make progress; the 10-second cadence returns when idle. The hourly maintenance pass is unchanged.
  • Trace index during merge: span compaction builds trace.fidx from the ordered merge stream instead of rereading the output, with byte-identical index files. A 128-input compaction fell from 5.9–6.2 s to 5.1–5.3 s.
  • Version markers: transfer and retirement use set-based statements (about 30 ms to 3 ms for 128 inputs under the write gate).
  • OTLP conversion: preallocated row slices and hoisted per-resource work (1,000 spans: 2.1 ms / 3.4 MB to 1.9 ms / 2.3 MB).

No configuration, format, physical-schema, durability or timeout changes.

Verification

  • just check (pre-push hook)
  • just test-race
  • New regressions: edge call output with the semi-join (TestEdgeRollupParentTraceScope, plan test), byte-identical streamed index (TestCompactionStreamingIndexMatchesReread), cancelled merge cleanup, backlog-driven schedule, bulk marker transfer, conversion fidelity (internal/ingest/testdata/conversion_rows.json)
  • Local sustained mixed ingest: end-of-run file count −37%, service rollup gate hold 3.9 s → 2.3 s, anomaly gate wait 2.4 s → 1.1 s
  • No credentials, private telemetry, host details, or enterprise-only source are included
  • API, migration, ingest, MCP/AG-UI, or release-contract changes are called out (none)

https://claude.ai/code/session_01XA52nWyQ3R5f5kK8kjpAQW

vishr added 2 commits October 15, 2026 01:03
…gest

On a 32-vCPU host at 478k items/s, Parquet files grew from 3,038 to 17,251
in five minutes, DuckDB native memory swung up to 31 GiB with no read load,
and version-rollup and anomaly writes timed out on the write gate.

- The edge rollup built its parent hash table from every span within an
  hour of the affected minute. It now semi-joins parents against the
  distinct traces of the affected children, keeping the one-hour range and
  identical call edges, so the build side no longer grows with ingest rate.
- Compaction starts its next cycle after 100 ms while cycles make progress
  and returns to the 10-second cadence when idle.
- Span compaction builds trace.fidx from the ordered merge stream instead of
  rereading the output; the index bytes are identical. A 128-input
  compaction fell from 5.9-6.2 s to 5.1-5.3 s.
- Version-marker transfer and retirement use set-based statements, cutting
  their time under the write gate from about 30 ms to 3 ms for 128 inputs.
- OTLP conversion preallocates row slices and hoists per-resource work:
  1,000 spans convert in 1.9 ms instead of 2.1 ms with 2.3 MB instead of
  3.4 MB allocated.

Locally under sustained mixed ingest, the end-of-run file count fell 37%,
the service rollup's gate hold fell from 3.9 s to 2.3 s, and the anomaly
writer's gate wait halved.

Claude-Session: https://claude.ai/code/session_01XA52nWyQ3R5f5kK8kjpAQW
The compaction and maintenance callbacks append to slices that the test
body reads; under the race detector that is a data race even inside a
synctest bubble. Guard both with a mutex and read copies.

Claude-Session: https://claude.ai/code/session_01XA52nWyQ3R5f5kK8kjpAQW
@vishr
vishr merged commit 5a234f4 into main Oct 15, 2026
14 checks passed
@vishr
vishr deleted the perf/sustained-ingest branch October 15, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant