adding rsockets support into JDK

Alan Bateman Alan.Bateman at oracle.com
Fri Apr 27 12:22:58 UTC 2018


On 24/04/2018 06:18, Lu, Yingqi wrote:
> Hi All,
>
> The version 2 of the patch is available at http://cr.openjdk.java.net/~ylu/8195160.02/
>
> In this version, I did following changes:
>
> 1. Remove RdmaSocket/RdmaServerSocket. Instead, use jdk.net.Sockets.openRdmaSocket and jdk.net.Sockets.openRdmaServerSocket to create RDMA based sockets. Internally, I use SocketImplFactory to connect Socket/ServerSocket with RdmaSocketImpl.
>
> 2. Remove RdmaSocketChannel/RdmaServerSocketChannel. Instead, use jdk.net.Sockets.openRdmaSocketChannel and jdk.net.Sockets.openRdmaServerSocketChannel to create RDMA based channels.
>
> 3. Move all the *impl classes from jdk.net to rdma.ch. rdma.ch only exports to java.base.
>
> A side note: rSocket does not currently support IPv4-mapped address. Since Java uses IPv6 as default whenever it is available, -Djava.net.preferIPv4Stack=true is needed for using IPv4 addresses. I think Socket Direct Protocol (SDP) has similar issue?
>
> Please let me know your feedback and comments. Really appreciate your help!
I've looked through the current webrev.

At a high-level, adding factory methods to jdk.net.Sockets looks 
reasonable, as does jdk.net.RdmaSocketOptions with the RDMA specific 
socket options.

I may have missed it, but I don't see how I can obtain a Selector to 
multiplex SocketChannels to RDMA sockets. Are you planning to add a 
factory method to jdk.net.Socket for this? A factory method will work 
and gives you somewhere to specify that it can only be used to multiplex 
SocketChannels to RDMA sockets.

Using a RdmaSocketImplFactory for the sockets created with classic 
networking seems reasonable. In the prototype you are changing the 
system-wide SocketImplFactory so it won't work when there are several 
threads creating sockets at around the same time. Instead, you'll need 
to change these to return new Socket(impl) { };  That will allow you to 
keep jdk.net.RdmaSocketImplFactory out of the API too.

For the initial version it might better to trim down the number of 
factory methods. You currently have 5 x openRdmaSocket and 4 x 
openRdmaServerSocket. One of each should be okay initially until you are 
further along.

There are few accidental API additions in the current webrev. It's 
really important that InetAddress doe snot have a public constructor, 
also the methods changed to public in Socket/ServerSocket are (I assume) 
just temporary.

One thing that we'll have to figure out at some point is testing as the 
API needs special hardware. This leads to a discussion on longer 
maintenance too.

The addressing issue is awkward. If there is no support for IPv4-mapped 
IPv6 address then it means running with -Djava.net.preferIPv4Stack=true 
as you mention. Yes, it's same issue with the SDP implementation on 
Linux. The DatagramChannel is the only example that comes to mind that 
has support for protocol specific sockets (you can create a 
DatagramChannel to an IPv4 only socket via the API). We may have to 
consider extending this support to Socket and SocketChannel. Most of 
work would be tests and testing of course. For now, requiring IPv4 only 
mode should be okay.

-Alan



More information about the nio-dev mailing list