[jboss-jira] [JBoss JIRA] (JGRP-809) Copyless stack
Bela Ban (JIRA)
issues at jboss.org
Sat Jun 27 03:02:05 EDT 2015
[ https://issues.jboss.org/browse/JGRP-809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084424#comment-13084424 ]
Bela Ban commented on JGRP-809:
-------------------------------
Hi Sanne,
yes, at first sight, I though I'd introduce ByteBuffer to the API. However, looking into NIO more closely, I realized there are many quirks that make it unfeasible to do that, e.g. not scattering reads and gathering writes for unconnected datagram sockets (UDP), lifecycle handling issues of direct buffers and so on.
Please read [1] and then let's have a chat. I'm interested in your opinion on this.
[1] https://github.com/belaban/JGroups/blob/master/doc/design/NIO2.txt
> Copyless stack
> --------------
>
> Key: JGRP-809
> URL: https://issues.jboss.org/browse/JGRP-809
> Project: JGroups
> Issue Type: Feature Request
> Reporter: Bela Ban
> Assignee: Bela Ban
> Fix For: 4.0
>
>
> Currently (as of 2.7), the transport reads the contents of a received packet into a buffer, then passes a *copy* of the buffer to a thread from the OOB or incoming thread pools. To prevent this copy, we can
> - have the receiver read only the version and OOB flag (to see which thread pool to dispatch the packet to)
> - pass a ref to the socket to a thread from the incoming of OOB pool, have that thread read the packet and return
> - each thread in the pool has its own buffer into which the buffer is read from the socket
> Possibly use NIO: we can install a selector and get woken up whenever data to be read is present. At that point, we can pass the ref to the socket to the handler thread and return immediately. NIO with channels for multicast sockets is available only in JDK 7 (or 8?), so this is a bit off... However, we can already implement this with reading the version and flags bytes and then passing the socket to the handler
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list