Skip to content

feat(ipc): Remove per-message flush in IPC writer hot path#9763

Open
pchintar wants to merge 1 commit intoapache:mainfrom
pchintar:remove-ipc-flush-hotpath
Open

feat(ipc): Remove per-message flush in IPC writer hot path#9763
pchintar wants to merge 1 commit intoapache:mainfrom
pchintar:remove-ipc-flush-hotpath

Conversation

@pchintar
Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

Currently, flush() is called unconditionally in write_body_buffers and write_continuation - both executed per batch. This forces per-batch syscalls, breaks write coalescing, and adds unnecessary overhead. These flushes are not required for correctness (IPC boundaries are length-prefixed, no durability guarantees).

What changes are included in this PR?

  • Remove flush() from write_body_buffers and write_continuation
  • Add self.writer.flush()? to StreamWriter::finish() (missing; FileWriter::finish() already has it)

Are these changes tested?

Yes the changes were tested successfully by running:

cargo test -p arrow-ipc
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings

Are there any user-facing changes?

No, There are no changes made to any Public APIs

@github-actions github-actions bot added the arrow Changes to the arrow crate label Apr 18, 2026
Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @pchintar -- this makes sense to me

I also verified that there are flush methods on FileWriter and StreamWriter, if anyone downstream really needs to flush more frequently

Comment thread arrow-ipc/src/writer.rs
}

write_continuation(&mut self.writer, &self.write_options, 0)?;
self.writer.flush()?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me to flush the stream on completion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove per-message flush overhead in Arrow IPC writer

2 participants