JGroups
JGroups copied to clipboard
Optimized receiving in TCP_NIO2
This contains several changes to improve performance of receiving messages in TCP_NIO2:
- An optimized way of reading from the channel to minimize the number of
channel.read()calls. I put this in a separate class as it is really very separate from the existingBuffersclass. - A change to direct buffers when receiving. This also meant changing to pass a stream to
Receiverinstead of an array (which aligns withTCP). - Adding a
read(byte[] b, int off, int len)toByteBufferInputStream. - An unrelated fix to the CRLF handling in
ByteBufferInputStream+ByteArrayDataInputStream(as suggested by ChatGPT 😅).
I can see some small performance improvements with this in my simple tests.
Please check/feedback/verify my tests. 🙂