-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
ByteToMessageDecoder to call fireChannelRead more frequently #4284
Comments
@ninja- Feel free to add more description. |
looks good to me. I could clarify that in my use case (a proxy) it wouldn't change the behaviour without the message squasher so it completes what squasher does rel #4285. |
…ead(...) at ByteToMessageDecoder Motivation: A long fight against spam of ChannelOutboundBuffer.Entry instances has revealed a need to pass decoded messages earlier in the decoding process so they could be released and instantly reused (ByteBufs). Modifications: ByteToMessageDecoder has been modified to fire channelRead(...) every 16 decoded messages with an option to override that number. Related issue: netty#4285
…ead(...) at ByteToMessageDecoder Motivation: A long fight against spam of ChannelOutboundBuffer.Entry instances has revealed a need to pass decoded messages earlier in the decoding process so they could be released and instantly reused (ByteBufs). Modifications: ByteToMessageDecoder has been modified to fire channelRead(...) every 16 decoded messages with an option to override that number. Results: The buffers are more quickly reused and the number of recycled entries has been reduced. Related issue: netty#4285
…(with voidPromise). Motivation: A long fight against spam of ChannelOutboundBuffer.Entry instances has revealed a need to squash these entries into one along with their buffers, especially the small buffers(small packets) were a big overhead. Modifications: The modified version of ChannelOutboundBuffer#addMessage now includes a fast-path that will append the data to latest buffer's entry(aka tailEntry) if following conditions are met: - both the requested message and tailEntry's message are ByteBufs - both the requested promise and promise of the tailEntry are void promises If needed, the tailEntry's buffer will be expanded by using the logic from ByteToMessageDecoder.Cumulator. Result: - dramatically reduce number of ChannelOutboundBuffer.Entry for proxy applications - less overhead for small packets - reduce the number of pooled buffers along with the entries, so they could be more efficiently reused - ability to disable this behaviour with a system property Real life test-case of a proxy app: - before this change: 1844 outbound entries and 1845 buffers - after this change: 4 entries and 4 buffers (!) (the test-case also required changes from netty#4284)
done @ PR #4288 |
Motivation: At the moment we only forward decoded messages that were added the out List once the full decode loop was completed. This has the affect that resources may not be released as fast as possible and as an application may incounter higher latency if the user triggeres a writeAndFlush(...) as a result of the decoded messages. Modifications: - forward decoded messages after each decode call Result: Forwarding decoded messages through the pipeline in a more eager fashion.
Motivation: At the moment we only forward decoded messages that were added the out List once the full decode loop was completed. This has the affect that resources may not be released as fast as possible and as an application may incounter higher latency if the user triggeres a writeAndFlush(...) as a result of the decoded messages. Modifications: - forward decoded messages after each decode call Result: Forwarding decoded messages through the pipeline in a more eager fashion.
Motivation: At the moment we only forward decoded messages that were added the out List once the full decode loop was completed. This has the affect that resources may not be released as fast as possible and as an application may incounter higher latency if the user triggeres a writeAndFlush(...) as a result of the decoded messages. Modifications: - forward decoded messages after each decode call Result: Forwarding decoded messages through the pipeline in a more eager fashion.
Motivation: At the moment we only forward decoded messages that were added the out List once the full decode loop was completed. This has the affect that resources may not be released as fast as possible and as an application may incounter higher latency if the user triggeres a writeAndFlush(...) as a result of the decoded messages. Modifications: - forward decoded messages after each decode call Result: Forwarding decoded messages through the pipeline in a more eager fashion.
…(with voidPromise). Motivation: A long fight against spam of ChannelOutboundBuffer.Entry instances has revealed a need to squash these entries into one along with their buffers, especially the small buffers(small packets) were a big overhead. Modifications: The modified version of ChannelOutboundBuffer#addMessage now includes a fast-path that will append the data to latest buffer's entry(aka tailEntry) if following conditions are met: - both the requested message and tailEntry's message are ByteBufs - both the requested promise and promise of the tailEntry are void promises If needed, the tailEntry's buffer will be expanded by using the logic from ByteToMessageDecoder.Cumulator. Result: - dramatically reduce number of ChannelOutboundBuffer.Entry for proxy applications - less overhead for small packets - reduce the number of pooled buffers along with the entries, so they could be more efficiently reused - ability to disable this behaviour with a system property Real life test-case of a proxy app: - before this change: 1844 outbound entries and 1845 buffers - after this change: 4 entries and 4 buffers (!) (the test-case also required changes from netty#4284)
Motivation: When connecting to an HTTP/2 server that did not set any value for the SETTINGS_MAX_HEADER_LIST_SIZE in the settings frame, the netty client was imposing an arbitrary maximum header list size of 8kB. There should be no need for the client to enforce such a limit if the server has not specified any limit. This caused an issue for a grpc-java client that needed to send a large header to a server via an Envoy proxy server. The error condition is demonstrated here: https://github.com/JLofgren/demo-grpc-java-bug-4284 Fixes grpc-java issue netty#4284 - grpc/grpc-java#4284 and netty issue netty#7825 - netty#7825 Modifications: In HpackEncoder use MAX_HEADER_LIST_SIZE as default maxHeader list size. Result: HpackEncoder will only enforce a max header list size if the server has specified a limit in its settings frame.
Motivation: When connecting to an HTTP/2 server that did not set any value for the SETTINGS_MAX_HEADER_LIST_SIZE in the settings frame, the netty client was imposing an arbitrary maximum header list size of 8kB. There should be no need for the client to enforce such a limit if the server has not specified any limit. This caused an issue for a grpc-java client that needed to send a large header to a server via an Envoy proxy server. The error condition is demonstrated here: https://github.com/JLofgren/demo-grpc-java-bug-4284 Fixes grpc-java issue #4284 - grpc/grpc-java#4284 and netty issue #7825 - #7825 Modifications: In HpackEncoder use MAX_HEADER_LIST_SIZE as default maxHeader list size. Result: HpackEncoder will only enforce a max header list size if the server has specified a limit in its settings frame.
Motivation: At the moment we only forward decoded messages that were added the out List once the full decode loop was completed. This has the affect that resources may not be released as fast as possible and as an application may incounter higher latency if the user triggeres a writeAndFlush(...) as a result of the decoded messages. Modifications: - forward decoded messages after each decode call Result: Forwarding decoded messages through the pipeline in a more eager fashion.
If a large amount of objects are added to the
out
list in ByteToMessageDecoder.decode for a single channelRead operation then this can result in a large amount ofByteBuf
objects to be allocated. There may be an opportunity for improvement in terms ofByteBuf
reuse and reduction of allocations if we can callfireChannelRead
more frequently.From @ninja- #4205 (comment):
The text was updated successfully, but these errors were encountered: