I have a TCP server application that listens for connections from clients that send heartbeat packets often at short intervals, about 20 seconds. There are several such clients, not more than 1000.
It was previously implemented (and not by me) such that for each beat a new TCP connection is used, then it closes.
It seems to me that it would be better to keep the connection open and reuse it for communication, but I'm not sure. Is re-establishing connections a waste of time and bandwidth and maintaining several hundred open connections (in the case of a server) is not a problem, or, conversely, is it a big waste of resources not to close them?
source share