3

Is it possible to create a Java TCP server with latency lower then 50 microseconds?

I tried both vanilla Java and Netty. The best I achieved is ~300 microseconds measuring by both Java System.nanoTime() and Wrk tool.

I want this without inter process communication optimizations (in which case ~1 microseconds can be achieved). I simulated a fair tcp connection by starting the server in a Docker container.

Artem Novikov
  • 4,087
  • 1
  • 27
  • 33
  • 1
    TCP is not know for his speed (because of every ACK needed), if you want speed (but accept some possible lost) use UDP. It also depends on where your server is located. – AxelH Aug 18 '17 at 13:47
  • Sure, thanks. But the question still is specifically about TCP. – Artem Novikov Aug 18 '17 at 13:48
  • java is not best known for its speed, however, latency depends on many things, the location, processes even the wire used to connect things and etc – nafas Aug 18 '17 at 13:51
  • FYI : [Latency depending on distance](https://superuser.com/questions/289978/whats-the-minimum-network-latency-for-a-1000-km-connection-using-optic-fibers). Because some value can't be reduce ;) Of course, this might not be the problem here. – AxelH Aug 18 '17 at 13:55
  • As I said, network (wires, etc) latency is cancelled out. Suppose you want to measure the time the request spends inside your computer. – Artem Novikov Aug 18 '17 at 13:57
  • Network latency is the same for UDP and TCP. If you send more than a certain threshold of data TCP will use more time because it has congestion control. Btw, are you talking about latency observed at the client? – FormerNcp Aug 21 '17 at 20:38

0 Answers0