0

I read api of nio2, and find these ways to improve :

AsynchronousSocketChannel.setOption(StandardSocketOptions.SO_RCVBUF, [size]);
AsynchronousSocketChannel.setOption(StandardSocketOptions.SO_SNDBUF, [size]);
[size] = RTT (from ping) * bandwidth (from net-card)

these are depand on given situation:

AsynchronousSocketChannel.setOption(StandardSocketOptions.TCP_NODELAY, ...); 
AsynchronousSocketChannel.setOption(StandardSocketOptions.SO_REUSEADDR, ...);
AsynchronousSocketChannel.setOption(StandardSocketOptions.SO_KEEPALIVE, ...);

Is there any other way for point to point?

skyrim
  • 21
  • 2
  • It depends on your use case. However, if you want to minimise latency and maximise throughput for a small number of connections I suggest using non-blocking NIO with busy waiting. If you just need high throughput, use blocking NIO. NIO2 only really helps if you have infiniband. – Peter Lawrey Sep 09 '14 at 13:47
  • Thanks man. I need transf large 100-bytes message in given order between two servers in a LAN. – skyrim Sep 10 '14 at 03:11

0 Answers0