Do not mandate direct bytes in SslHandler queue (#9656)
Motivation: Currently when the SslHandler coalesces outbound bytes it always allocates a direct byte buffer. This does not make sense if the JDK engine is being used as the bytes will have to be copied back to heap bytes for the engine to operate on them. Modifications: Inspect engine type when coalescing outbound bytes and allocate heap buffer if heap bytes are preferred by the engine. Result: Improved performance for JDK engine. Better performance in environments without direct buffer pooling.
This commit is contained in:
parent
665cdf1ec4
commit
678983f2a7
@ -2137,7 +2137,11 @@ public class SslHandler extends ByteToMessageDecoder {
|
||||
protected ByteBuf composeFirst(ByteBufAllocator allocator, ByteBuf first) {
|
||||
if (first instanceof CompositeByteBuf) {
|
||||
CompositeByteBuf composite = (CompositeByteBuf) first;
|
||||
if (engineType.wantsDirectBuffer) {
|
||||
first = allocator.directBuffer(composite.readableBytes());
|
||||
} else {
|
||||
first = allocator.heapBuffer(composite.readableBytes());
|
||||
}
|
||||
try {
|
||||
first.writeBytes(composite);
|
||||
} catch (Throwable cause) {
|
||||
|
Loading…
Reference in New Issue
Block a user