Replies: 1 comment 1 reply
-
The restrictions placed by the new API means we have to think outside of the box in some cases. In your case, as I understand it, a buffer will be written verbatim/unchanged to multiple channels. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I saw the announcement about Netty 5, and in general, I like the changes that are being made. But it feels like an important use case may have been overlooked. Specifically, any protocol that has a publish/subscribe mechanism.
Let's use a chatroom application as an example. When a user sends a message, that message is forwarded to all other users in the chatroom. In Netty 4, the ByteBuf comes in on one channel, and I can use retainedDuplicate() to clone the buffer and write it to all the other channels without copying or allocating any additional memory.
But that's impossible with the Netty 5 Buffer API. As far as I can tell, the closest I can get is BufferAllocator#constBufferSupplier(). This requires a memory copy, and unless I maintain my own pool of byte arrays to use for this purpose, it also requires a memory allocation. Which feels like it could have a significant performance impact, if an application does this a lot. I'm unsure whether this would be a concern for the real-world applications I work on.
Is there any plan to address this? Apologies if there is and I missed it. I didn't see any discussion of this particular case in any issues, the migration guide, or the Javadoc.
Beta Was this translation helpful? Give feedback.
All reactions