Interview Prep/Networking/Performance, MTU, Latency & Tools

Your server shows thousands of sockets in TIME_WAIT. Is that a problem?

IntermediateScenarioPerformance, MTU, Latency & Tools
Answer

Situation read → Usually not, unless it exhausts ephemeral ports on a client.

What I'd do →

  1. Count states: ss -s and ss -tan state time-wait | wc -l
  2. TIME_WAIT lasts 60 seconds on Linux and protects against late packets
  3. The real problem is port exhaustion on a client making many outbound connections to one destination
  4. Widen the range: sysctl -w net.ipv4.ip_local_port_range="10240 65535"
  5. Use keep-alive and connection pooling instead of tweaking tcp_tw_reuse

Why → TIME_WAIT is a feature, and fewer short connections is the actual fix.

Interview tip → Say never enable the removed tcp_tw_recycle.

All Networking questions Roadmap: Networking for DevOps

More on Performance, MTU, Latency & Tools