Network & Infrastructure / Linux Networking & Host Performance
Ephemeral-port exhaustion in a high-churn client application
A service cannot open new outbound connections to one destination even though the network is reachable. Its local source-port space may be constrained by connection churn and retained state.
Environment and inputs: Linux network namespaces, host routing and network drivers; availability and semantics depend on kernel and driver versions. Diagnostic/design example; not tested on production equipment.
Collect the evidence
Collect socket errors, connection states, destination concentration, source-address selection and the configured ephemeral range. Compare client-side failures with gateway NAT allocation evidence.
Explain the result
Available connection tuples are finite and depend on source/destination combinations and lifecycle rules. A high TIME_WAIT count is evidence to interpret, not proof that every retained socket should be removed.
Plan the fix
Reduce unnecessary connection creation with suitable application reuse and size source-address capacity for the workload. Avoid unsupported TCP reuse tuning that risks correctness to recover short-term capacity.
Check the result and rollback
Load-test realistic request patterns and verify completed work, not only successful connects. Restore previous settings if stale connection confusion or intermittent data delivery appears.