-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: optmize NettyChannelHandlerAdapter with explict extends. #1667
Conversation
onMessage(ctx, buf) | ||
} catch { | ||
case ex: Throwable => transformException(ctx, ex) | ||
} finally buf.release() // ByteBuf must be released explicitly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was released by the finally
block in SimpleChannelInboundHandler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the upstream code is at https://github.com/netty/netty/blob/4.1/transport/src/main/java/io/netty/channel/SimpleChannelInboundHandler.java
unrolling the generic code that checks for types dynamically makes some sense
I ran the cluster test locally and it passed too, we are using this kind of trick at work. |
@raboof @pjfanning Do you think we should backport this? as Flink will use this pekko too. |
I don't want to pre-empt anything. If Flink team want to test the 1.2.0 snapshot and find that works better for them - we could then consider backporting this. |
Motivation:
Performance, it was extended to the
SimpleChannelInboundHandler
which will check if the type is aByteBuf
, now, we just test it explicitly.Modification:
Make it extends the
ChannelInboundHandlerAdapter
andrelease
explicitly , which was released by theSimpleChannelInboundHandler
Result:
Simple code and performance a little better.