How Many TCP Connections?

Your host might be experiencing a latency issue and the network looks OK. Where is the bottleneck? If many TCP connections are made to a host somehow, that can cause latency issue. Let’s count how many TCP connections are made on the host.

$ wc -l /proc/net/tcp

The output looks like the following.

256 /proc/net/tcp

If the number is ridiculously high, like hundreds of thousands of connections, there may be an issue with the way code is written. For example, if many database connections are open to the database, this kind of issue can happen.