Thousands of TIME_WAIT Sockets
A service that calls an API shows thousands of sockets in TIME_WAIT and sometimes fails with "Cannot assign requested address". What is the best fix?
TIME_WAIT
Choose one answer
Switch the API calls from TCP to UDP.
Reuse connections with keep-alive or a pool.
Set the kernel's TIME_WAIT duration to zero.
Restart the service every hour to clear the sockets from the kernel's tables.