Problem Statement

In microservice architectures, unpooled inter-service HTTP requests trigger continuous TCP 3-way handshakes and leave sockets stranded in TIME_WAIT for 60 seconds.

Diagnostics

At 15k RPS, socket count in TIME_WAIT hit kernel port exhaustion limits:

BASH
ss -s
cat /proc/sys/net/ipv4/ip_local_port_range

Resolution

  • Implemented HTTP client connection pooling (MaxIdleConns = 100, IdleConnTimeout = 90s).
  • Tuned kernel sysctl: net.ipv4.tcp_tw_reuse = 1 and net.ipv4.tcp_fin_timeout = 15.