Repository navigation
Conversation
A table's partial batch waits for its row or byte budget or for flush_timeout (1 s by default) after its first row. When a burst or a catch-up ends, its last partial batch therefore sits a full timeout before it reaches ClickHouse, and every acknowledgement behind it waits with it: about 1 s of the write-heavy repro's tail, where every earlier batch had sealed by budget. A table whose last batch sealed by budget is taking rows in bulk, so seal its partial batch as soon as the batcher has had no input for a tenth of flush_timeout. Its next partial batch is not bulk and waits out the full timeout again, so a trickle still coalesces as before, and at most one short batch follows each full one. ClickHouse still acknowledges each row before the resume-safe position passes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
I don't think this is a good change. Our focus should be on consistency: trying to maintain throughput with a given latency target. If latency target is 500ms there's no need to try get bursty workload to send in 50ms. Maybe bursty workload hits every 100ms so you end up sending 5 inserts now with 50ms latency instead of 500ms latency, but 500ms might've been chosen to avoid too many parts. I'm already unsure 500ms will play nice with parts. This same argument only applies more if walshadow configured with 10s flush timeout |
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.
Final partial batch after bulk input waits for full flush timeout, delaying acknowledgement. Seal bulk remainder after input idles for one tenth of timeout. Preserve full timeout for subsequent trickle batches.
Extracted from original #228 and based directly on
main. Contains no changes from #226 or other extracted PRs.Validation:
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --locked -- -D warnings, andcargo test --locked --lib emit::pipeline::batcher(17 passed). Rebuild crate for each isolated diff.Measured impact (2026-10-22)
Compared
069c23046f261d30c97eced1427d103e617c6608against shared parent151fd47cbd75ec7b9bc63ffe7040f049e702ecd0, with each PR built separately.Workload: production batcher, one table, 500 ms flush timeout, row budget 2. Send three rows; consume full batch and time final one-row remainder. Then send one additional row and time its seal. Verify both partial batches contain one row and batcher exits without fatal error. Uses real timers. Measures batch sealing latency before inserter/ClickHouse acknowledgement; concurrent traffic to other tables was not measured.
AMD Ryzen 7 7840U; rustc 1.99.1; locked dependencies; optimized release builds; mimalloc 0.1.52. Seven trials per revision, alternating base/PR order, pinned to CPUs 2,4,6 (three physical cores). Values show median [min, max]; negative time changes mean less work or waiting. Local component measurements, without PostgreSQL or ClickHouse services.