DatagramChannel performance issue

Alan Bateman Alan.Bateman at oracle.com
Mon Aug 27 12:08:07 UTC 2018


Moving this one to nio-dev.

On 25/08/2018 17:42, Martin Thompson wrote:
> We've been diagnosing a performance issue and isolated it to receiving
> on a datagram socket
> where we are seeing a significant step down in performance, and
> increase in allocation, when
> more than one source is sending.
>
> https://github.com/frohoff/jdk8u-jdk/blob/master/src/windows/native/sun/nio/ch/DatagramChannelImpl.c#L138
>
> When receiving from two or more sources we get InetAddress and
> InetSocketAddress objects
> allocated and they are set via multiple up calls from the JNI code into Java.
>
> A much more efficient implementation would be one that passes down two
> ByteBuffers.
> One to be filled in for the payload and one for the header. Allocation
> on a per packet receive
> is not a useful design for a network API.
>
> A read operation is not a valid alternative as we need the sender address.
>
> Regards,
> Martin...



More information about the nio-dev mailing list