netty: SSLHandler slows down large file transfer
I try to send a file larger then 5MB over the following pipeline:
- SSLHandler
- ByteToMessageCodec
- IdleStateHandler
- SimpleChannelInboundHandler
Sending a 10MB file takes arround 3Sekonds. When I remove the SSLHandler the file is transferred within 800ms. I found out that the SSLHandler Chunks the bytebuffer into very tiny pieces, that take forever to be sent.
I use the UnpooledByteBufAllocator.DEFAULT in my ChannelOptions. my encode method form the ByteToMessageCodec looks like this:
protected void encode(ChannelHandlerContext channelHandlerContext, IMessage iMessage, ByteBuf byteBuf) throws Exception {
if(byteBuf.isWritable()){
byteBuf.writeBytes((serializer.serialize(iMessage) + RECORD_SEPARATOR).getBytes());
}
}
Is there a way to tweek the SSLHandler?
Maybe the SSLEngine is the troublemaker? I found the following line of code inside the SSLHandler, but this constructor is depricated:
wantsLargeOutboundNetworkBuffer = !opensslEngine;
Netty version
4.0.40
JVM version
java version “1.8.0_111” Java™ SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot™ 64-Bit Server VM (build 25.111-b14, mixed mode)
OS version
Win10
StackOverflow
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (13 by maintainers)
@konsultaner demo project would be excellent.