SO_REUSEPORT feature support in JDK 9 for socket communication

Viswanathan, Sandhya sandhya.viswanathan at intel.com
Fri Oct 23 22:57:12 UTC 2015


Thanks for all your inputs. 

To start with, we will create a patch for JDK-6432031 based on JDK 9 and submit to both the core-libs-dev and net-dev mailing lists. 

We will include the SocketOption interface (getOption/setOption) also for this feature (we had that in our JDK 8 based prototype).

As most of the platforms support SO_REUSEPORT and this feature shows significant performance benefit, it would be worthwhile to give it a try.

There are other features in SocketOptions like SO_REUSEADDR which has the mechanism to handle if it is not supported by all existing platforms.
Excerpts from file java/net/DatagramSocket.java below:
     * Note: This functionality is not supported by all existing platforms,
     * so it is implementation specific whether this option will be ignored
     * or not. However, if it is not supported then
     * {@link #getReuseAddress()} will always return {@code false}.
     * <p>
     * When a {@code DatagramSocket} is created the initial setting
     * of {@code SO_REUSEADDR} is disabled.

I am hoping that we could do something similar for SO_REUSEPORT as well.

Best Regards,
Sandhya

-----Original Message-----
From: core-libs-dev [mailto:core-libs-dev-bounces at openjdk.java.net] On Behalf Of Mark Sheppard
Sent: Thursday, October 22, 2015 8:06 AM
To: Michael McMahon; Alan Bateman; Roger Riggs; OpenJDK Dev list
Cc: core-libs-dev at openjdk.java.net
Subject: Re: SO_REUSEPORT feature support in JDK 9 for socket communication

the following JBS item exists:
https://bugs.openjdk.java.net/browse/JDK-6432031

search of windows documentation suggests that SO_REUSEPORT is still not 
an option

man setsockopt on Solaris shows it as an option, but without precise 
description of semantics

regards
Mark

On 22/10/2015 14:33, Michael McMahon wrote:
> On 22/10/15 14:24, Alan Bateman wrote:
>>
>>
>> On 22/10/2015 14:04, Roger Riggs wrote:
>>> Hi Sandhya,
>>>
>>> The folks on net-dev at openjdk.java.net will be interested too.
>> Yes, net-dev is the best list for this.
>>
>> One other thing to mention is the SocketOption interface and the 
>> setOption/getOption methods. This allows for platform or JDK-specific 
>> specific socket options, it also allows it to be implemented by the 
>> NIO SocketChannel and friends.
>>
>> -Alan
>
> and there is the jdk.net API which extends this to the java.net socket 
> types.
>
> I think a Java SE API would be fine if it is widely and consistently 
> implemented
> across all the reference platforms and if it does not cause 
> compatibility issues.
>
> If it only works on some platforms then maybe jdk.net could be the 
> place for it.
>
> - Michael




More information about the core-libs-dev mailing list