Skip to content

Commit b843f4a

Browse files
authored
Increase the GZip DeflaterOutputStream buffer size to increase performance (#36818)
1 parent 914c16e commit b843f4a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sdks/java/core/src/main/java/org/apache/beam/sdk/io/Compression.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ public ReadableByteChannel readDecompressed(ReadableByteChannel channel) throws
9999

100100
@Override
101101
public WritableByteChannel writeCompressed(WritableByteChannel channel) throws IOException {
102-
return Channels.newChannel(new GZIPOutputStream(Channels.newOutputStream(channel), true));
102+
// Increase the default deflate output stream buffer size from 512 to 4096 for performance.
103+
return Channels.newChannel(
104+
new GZIPOutputStream(Channels.newOutputStream(channel), 4096, true));
103105
}
104106
},
105107

0 commit comments

Comments
 (0)