JEP 337: RDMA Network Sockets

OwnerYingqi Lu
Componentcore-libs / java.nio
Discussionnio dash dev at openjdk dot java dot net
Reviewed byAlan Bateman, Chris Hegarty
Created2018/05/18 16:58
Updated2020/02/12 15:52


Enhance the JDK networking API to support remote direct memory access (RDMA) using the rsocket protocol on Linux-based platforms.


For HPC and cloud applications, fully utilizing networking hardware capabilities to reach maximum bandwidth at low latency is challenging. Networking libraries inside the JDK currently use operating-system kernel sockets. Multiple memory copies between user and kernel spaces are involved during data transfers, which are expensive in both memory bandwith and CPU cycles. To improve this, we propose to add support for rsocket, a protocol over remote direct memory access (RDMA) that permits high-throughput, low-latency networking.


In computing, remote direct memory access (RDMA) is a direct memory access from the memory of one computer into that of another without involving either one's operating system. This permits high-throughput, low-latency networking, which is especially useful in massively parallel computer clusters. RDMA supports zero-copy networking by enabling the network adapter to transfer data directly to or from application memory, eliminating the need to copy data between application memory and the data buffers in the operating system. Such transfers require no work to be done by CPUs, caches, or context switches, and transfers continue in parallel with other system operations. When an application performs an RDMA Read or Write request, the application data is delivered directly to the network, reducing latency and enabling fast message transfer. — Wikipedia

rsocket is a protocol over RDMA that supports a C API for applications. The API intended to match the familiar socket API. For example, to create a socket and return a file descriptor,

default socket call: int socket(int domain, int type, int protocol);
rsocket function:    int rsocket(int domain, int type, int protocol);

The JDK networking libraries use the standard socket API, so the rsocket API is a good fit for enabling RDMA on both traditional sockets and non-blocking socket channels.

Proposed JDK-specific API

The rsocket feature is non-standard and is only available on Linux platforms. Therefore, the proposal here is to add a Java API to the package of the module, which is where other JDK-specific networking features are already exposed. On platforms where rsocket is not supported, an UnsupportedOperationException will be thrown if the APIs are used.

A new class named will define factory methods to create RDMA-based TCP sockets and channels. openSocket(ProtocolFamily family) openServerSocket(ProtocolFamily family)
java.nio.channels.SocketChannel openSocketChannel(ProtocolFamily family)
java.nio.channels.ServerSocketChannel openServerSocketChannel(ProtocolFamily family)
java.nio.channels.Selector openSelector()



Risks and Assumptions