Skip to content

AVRO-4240: [Java] Size DataFileWriter output buffer to fit entire block frame#3705

Open
belugabehr wants to merge 1 commit intoapache:mainfrom
belugabehr:AVRO-4240/optimize-writeblockto-buffer-size
Open

AVRO-4240: [Java] Size DataFileWriter output buffer to fit entire block frame#3705
belugabehr wants to merge 1 commit intoapache:mainfrom
belugabehr:AVRO-4240/optimize-writeblockto-buffer-size

Conversation

@belugabehr
Copy link
Contributor

What is the purpose of the change

This pull improves write performance as DataFileWriter wraps its output in a BufferedFileOutputStream that uses the default 8KB BufferedOutputStream buffer. The default sync interval was increased from 16KB to 64KB in AVRO-1398 but the output buffer was never adjusted. Since block data far exceeds 8KB, each block write results in multiple write syscalls and flushes instead of one.

This change sizes the output buffer to fit a complete block frame (compressed data + varint headers + sync marker) so that all writes accumulate and flush in a single syscall, fixing AVRO-4240.

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Documentation

  • Does this pull request introduce a new feature? (yes / no) no
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented) JavaDoc

@github-actions github-actions bot added the Java Pull Requests for Java binding label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java Pull Requests for Java binding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant