perf: background write batcher for DuckDB telemetry ingest#272
Draft
jstojiljkovic wants to merge 12 commits into
Draft
perf: background write batcher for DuckDB telemetry ingest#272jstojiljkovic wants to merge 12 commits into
jstojiljkovic wants to merge 12 commits into
Conversation
…eway into feat/write-optimization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DuckDB ingest did all storage work inside each request: one connection, one Appender, one WAL commit per HTTP request, with the admission gate capping concurrency at 4. Requests held slots for 1-3s each. At the benchmark cliff, ingest p50 was 1.2-3.2 seconds.
What changed
telemetry/duckdb/writer.go): requests decode, convert, and enqueue onto a bounded per-table queue, then return 200 in milliseconds; a pool of writers per hot table (2xCPU, capped 8) owns persistent Appenders and flushes at 32k rows / 100ms, so one WAL commit is shared by hundreds of requests. A 200 now means "accepted into the queue" (OTel-Collector-style ack, loss window ≤ one flush on crash)./api/health/deepandtraceway.duckdb.write_queue.*metrics.Results:
Same hardware (ccx13, 2 vCPU) - datasets committed on this branch:
Hardware scaling (same code, ccx23, 4 vCPU), artifacts on runs
30009675827 / 30028543147
Writers, admission, and DuckDB threads all scale with CPU, so capacity scales near-linearly with cores - previously added cores mostly fed per-request overhead. On both tiers, the load generator saturates before the SUT on spans/metrics small-batch traffic (0% SUT errors at the failed loadgen steps).
Zero dropped rows and zero insert failures in every step of every run. Read-probe pass levels are unchanged; the spans/logs 100M read cliffs predate this branch