You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/10/26 05:29:44 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #9499: KAFKA-10470: Zstd upgrade and buffering

chia7712 commented on a change in pull request #9499:
URL: https://github.com/apache/kafka/pull/9499#discussion_r511726299



##########
File path: clients/src/main/java/org/apache/kafka/common/record/CompressionType.java
##########
@@ -119,7 +119,9 @@ public InputStream wrapForInput(ByteBuffer inputBuffer, byte messageVersion, Buf
         @Override
         public OutputStream wrapForOutput(ByteBufferOutputStream buffer, byte messageVersion) {
             try {
-                return (OutputStream) ZstdConstructors.OUTPUT.invoke(buffer);
+                // Set input buffer (uncompressed) to 16 KB (none by default) to ensure reasonable performance
+                // in cases where the caller passes a small number of bytes to write (potentially a single byte)
+                return new BufferedOutputStream((OutputStream) ZstdConstructors.OUTPUT.invoke(buffer), 16 * 1024);

Review comment:
       Is ```BufferedOutputStream``` good to other compression also?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org