Patch for adding SO_REUSEPORT socket option
yingqi.lu at intel.com
Fri Nov 20 02:12:01 UTC 2015
Yes, we have an open discussion there as well. From now on, we will focus on net-dev.
From: David Holmes [mailto:david.holmes at oracle.com]
Sent: Thursday, November 19, 2015 6:10 PM
To: Lu, Yingqi <yingqi.lu at intel.com>; Kharbas, Kishor <kishor.kharbas at intel.com>; core-libs-dev at openjdk.java.net
Subject: Re: Patch for adding SO_REUSEPORT socket option
I think this should be moved to the net-dev mailing list.
On 20/11/2015 6:37 AM, Lu, Yingqi wrote:
> Hello All,
> Currently, I think the only platform that does not have SO_REUSEPORT is Windows. API allows this possibility by throwing SocketException with message "Invalid option". Older kernel that does not support the feature throws SocketException with message "Protocol not available".
> Here is the first version of the patch (we implement SO_REUSEPORT as a standard socket option): http://cr.openjdk.java.net/~mcberg/jdk/6432031/webrev.01/
> Here is the second version of the patch (we implement SO_REUSEPORT as an extended socket option): http://cr.openjdk.java.net/~mcberg/jdk/6432031/webrev.02/
> The performance improvement by enabling SO_REUSEPORT is significant (up to 1.93x on Hadoop Distributed File System (HDFS)). It would be great if OpenJDK can have it. Please take some time to review the patches and let us know your feedback and comments!
> From: Kharbas, Kishor
> Sent: Monday, November 16, 2015 10:47 AM
> To: core-libs-dev at openjdk.java.net
> Cc: Kharbas, Kishor; Lu, Yingqi; Kharbas, Kishor
> Subject: Patch for adding SO_REUSEPORT socket option
> Hello all,
> I request the community to review a patch for adding SO_REUSEPORT support. There is already an existing JBS opened at https://bugs.openjdk.java.net/browse/JDK-6432031
> Details :
> SO_REUSEPORT removes 1:1 assignment between listen socket and IP:PORT pair and enable multiple sockets listening to the same address and port. This improves the scalability and parallelism of network traffic handling. It is enabled for both TCP and UDP sockets (at least for Linux). For more details, please refer to https://lwn.net/Articles/542629/. Many applications, especially Linux or BSD based webservers such as Apache httpd and Nginx are already supporting it now. Ruby and Python have it supported as well. Other Java applications such as Netty webserver have it supported via JNI function since JDK has not supported it yet.
> By enabling the SO_REUSEPORT feature itself, up to 4X throughput and latency improvement have been observed from various applications. Specific to Java application with this patch, we modified Apache Hadoop Distributed File System (HDFS) source code to take advantage of this feature. We observed up to 1.93x performance improvements.
> The feature is supported since Linux Kernel 3.9. It is also supported in BSDs, Solaris and Mac OS. Windows does not have it. In the current patch, we only enable the feature on Linux platform since we do not have BSD, Solaris and Mac OS for testing. Whether the feature is supported or not on the running kernel is determined at the run time.
> P.S. Based on Alan Baleman's comment on JBS, we are in meanwhile working on adding this option to 'java.net.ExtendedSocketOption'.
> Kishor Kharbas
More information about the core-libs-dev