liangyepianzhou commented on issue #23586: URL: https://github.com/apache/pulsar/issues/23586#issuecomment-2467636974
>Since the Pulsar Java client is Java 8+, using the ByteBuffer methods would require the use of reflection (unless a multi-release jar file is used with separate classes for Java 8 and Java 11). There's a reflection example in different situation in [BookKeeper's Java9IntHash class](https://github.com/apache/bookkeeper/blob/master/circe-checksum/src/main/java/com/scurrilous/circe/checksum/Java9IntHash.java). This is indeed an optimization direction, but I am worried whether upgrading the JDK version of the client will cause trouble for users to upgrade. >For Netty ByteBuf input, it's possible to achieve zero copy in most cases by using Netty ByteBuf's nioBuffer method. It's notable that using nioBuffer method will cause copies when the Netty ByteBuf input is a CompositeByteBuf. Netty doesn't have a good way for zero copy of CompositeByteBuf input. In BookKeeper, there's a solution for checksum calculation in the https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/ByteBufVisitor.java class, which can visit all buffer parts to avoid extra copies. A similar solution would be applicable to compression. My concern is, does the Pulsar client really use `CompositeByteBuf` to send messages? -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
