views:

87

answers:

1

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 of 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.
+1  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).

ripper234
Hmm check my answer on SO for a laugh.http://serverfault.com/questions/92167/why-am-i-getting-long-tcp-connect-latency-on-connect-in-a-lan-over-a-cross/92546#92546
ripper234