perf(eap): Stream RowBinary INSERTs instead of buffering - #8462
Open
phacops wants to merge 2 commits into
Open
Conversation
Replace Reduce → RowBinaryWriterStep with a streaming writer so EAP consumers compress and POST RowBinary blocks as messages arrive instead of holding the full uncompressed batch. Unlike #8001, keep clickhouse_concurrency in-flight slots and only retry after the body is complete so a mid-stream failure cannot ACK a truncated insert. Refs LINEAR-EAP-517
phacops
marked this pull request as ready for review
September 10, 2026 21:13
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1a628e4. Configure here.
RunTaskInThreads can deliver many completed messages in one cycle with no intervening poll. Close the INSERT body in submit once max_batch_size is reached so a single streamed write cannot grow unbounded.
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.

RowBinary consumers now stream compressed INSERT bodies to ClickHouse as rows arrive, instead of accumulating the full uncompressed batch in
Reducebefore the write.--use-row-binary(already on for EAP items) swapsReduce → RowBinaryWriterStepforStreamingClickhouseWriter. Each message is LZ4-framed into ClickHouse-native 1 MiB blocks and pushed onto an in-flightINSERT … FORMAT RowBinaryPOST; uncompressed bytes are dropped insubmit(). JSON storages stay on the buffered writer.This is a re-land of #8001 with the two revert causes fixed:
insert_distributed_sync=1, which showed up as consumer pause time. This keepsclickhouse_concurrencyslots and completes them in order so a later offset cannot commit before an earlier write.body_completeso they replay the full compressed body, not a prefix. Abandoning a batch (rebalance / join timeout) aborts the HTTP task before dropping the sender, so a connection reset cannot land as a successful truncated write.The first-attempt request timeout is
request_ms + max_batch_timeso the open connection covers accumulation plus the write; retries use plainrequest_ms. Peak writer memory for a batch of sizeBis the compressed retry buffer (~0.3×B) rather than the uncompressed Reduce accumulator.Watch EAP canary RSS and pause time on deploy. The ClickHouse
MEMORY_LIMIT_EXCEEDED/max_insert_block_sizelever from #7939 is unchanged.