Opening a new TCP connection can have some overhead, especially if the client and server are located in different networks or across the Internet. The following are some of the overheads that can be incurred when opening a new TCP connection:

  • Three-way handshake: A TCP connection is established using a three-way handshake. This involves the client sending a SYN (synchronize) packet, the server responding with a SYN-ACK (synchronize-acknowledge) packet, and the client responding with an ACK (acknowledge) packet. This process incurs a small amount of overhead, as each packet requires additional headers and processing.
  • DNS Lookup: The client needs to resolve the domain name to an IP address before it can establish the connection, this process can take some time, and also incurs some overhead.
  • Authentication: Some servers require the client to authenticate itself before a connection can be established, this can incur additional overhead if the client needs to transmit additional data for authentication.
  • Network Latency: If the client and server are located in different networks or across the Internet, the packets that make up the connection request and response need to traverse the network, which can add to the latency of the connection request.
  • Congestion Control: In case of high traffic in a network, a new connection might get delayed due to congestion control algorithms such as slow-start or back-off algorithms.
  • SSL/TLS: When an SSL/TLS connection is used, additional steps such as a SSL/TLS handshake are performed which also incur overhead in terms of computation and encryption/decryption.

It’s worth noting that these overheads are generally small, especially for connections that are established over a LAN, and for the majority of small requests and responses the overhead is negligible compared to the benefits of opening a new connection. However, for long-lived connections or high-traffic applications, these overheads can add up and impact the overall performance.