I'm working on a client-server pair where the multithreaded client performs thousands invocations of the server per second and the first priority is to achieve a minimal latency. Throughput should be high as well. Both client and server are written in Java, communication semantics is quite simple (put/get operations).
What is the best Java network library/framework for these requirements? Servers like Tomacat/Jetty seems to be heavyweight. I'm thinking about MINA or Netty, but I'm not sure that these asynchronous libs will provide a stable low latency under heavy workload.
I suggest you to try kryonet framework.
If you want to communicate on the same machine you can try something like Java Chronicle which can support over a million persisted messages per second with sub-microsecond round trip times.
If you want low latency between machines, you need to look very carefully at your hardware. For commodity hardware your round trip latency will be 100 micro-seconds per more. With specialist hardware you are looking closer to 20 micro-seconds.
Or you could communicate on the same box and get much lower latencies. ;)
You can also try Jocket. It shares some concepts with Java Chronicle but is directly targeted at replacing the standard Socket implementation.
RTT latency is below the microsecond for a ping-pong between processes.
If you need ultra-high performance and throughput, I recommend using raw sockets (check out Socket and ServerSocket - there may be an nio version too). This will free you from the overhead contained in HTTP and other protocols
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With