Sockets
Explore how sockets function in distributed systems, including ephemeral ports, virtual IP addressing, and the TCP connection lifecycle. Understand limitations on concurrent connections and the role of TCP states like TIME_WAIT in preventing data conflicts. Gain insights into optimizing socket management for robust system resilience.
We'll cover the following...
Ephemeral sockets
We may not spend much time thinking about the number of sockets on our server, but that’s another limit we can run into when traffic becomes heavy. Every active request corresponds to an open socket. The operating system assigns inbound connections to an “ephemeral” port that represents the receiving side of the connection. If we look at the TCP packet format, we’ll see that a port number is 16 bits long. It can only go up to 65,535. Different OSs use different port ranges for ephemeral sockets, but the IANA recommended range is 49,152 to 65535. That gives ...