开发者

TCP Connect takes X100 longer than ping

开发者 https://www.devze.com 2022-12-13 20:52 出处:网络
I have a java process on machine A communicating with a Tomcat on machine B via TCP. The TCP connect (just the syn-syn/ack exchange) takes on the order o开发者_C百科f 100 ms consistently, while a ping

I have a java process on machine A communicating with a Tomcat on machine B via TCP. The TCP connect (just the syn-syn/ack exchange) takes on the order o开发者_C百科f 100 ms consistently, while a ping request takes 1 ms (the serves are on the same LAN).

  1. What could cause the increased delay in establishing a TCP connection?
  2. How do I optimize it?

Note that:

  • This is not yet a 3-way-handshake, I'm measuring only the syn/syn-ack exchange.
  • The server is a very strong machine and not under load at all.
  • The connect request is to an IP, not a hostname, so no DNS lookup is involved. In fact, this is not relevant since I'm measuring the time sine the SYN left machine A.


It seems the problem is not in the client or server themselves. I took two packet dumps on the client and server:

  1. The client sees a 100-150 ms time difference between seeing the SYN and receiving the SYN/ACK.
  2. The server sees only a 20 ms time difference between receiving the SYN and sending the SYN/ACK.

Ergo, the problem must be in some intermediate layer (router/firewall/whatnot).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号