DatagramChannel performance issue

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 28 07:31:14 UTC 2018


On 27/08/2018 20:09, Martin Thompson wrote:
> :
> I'd be happy to help if I can. How do you think the existing method
> can be improved? Would there need to be some sort of cache of address
> objects to honour the existing receive API which returns an address?
One starting point is create some benchmarks for evaluating changes to 
the implementation. The performance issue with unconnected 
DatagramChannel has existed since JDK 1.4 and (to my knowledge anyway) 
hasn't been brought up as a performance bug here or in JBS. So creating 
an initial set of benchmarks would be good to at least get a sense for 
the current performance.

As regards implementation changes then I think start by eliminating the 
JNI calls from the receive implementation and move it all to java. Each 
DCI can have an area of memory (probably 18 bytes) for the native code 
to write the source address and port. The wrapper can create the 
InetAddress/InetSocketAddress. Once you get that far then you can 
evaluating if there is a need for any caching of InetAddress objects, 
maybe the existing one-entry cache can be removed, maybe it would be 
beneficial to have more caching. The benchmarks, along with other 
measurements, should be help evaluate.

-Alan.


More information about the nio-dev mailing list