Linux 'ss' command - TCP connections

I am getting below output/summary while running few gatling & AB perf test as a result of command -

$ ss -stplu

Output -

Total: 517 (kernel 0)
TCP:   11261 (estab 3, closed 11254, orphaned 1, synrecv 0, timewait   11235/0), ports 0

Transport Total     IP        IPv6
*      0         -         -        
RAW      1         0         1        
UDP      0         0         0        
TCP      7         5         2        
INET      8         5         3        
FRAG      0         0         0        

Netid State      Recv-Q Send-Q                       Local    Address:Port                                        Peer Address:Port                
tcp   LISTEN     0      128                                      *:59122                                                  *:*                    
tcp   LISTEN     0      100                              127.0.0.1:smtp                                                   *:*                    
tcp   LISTEN     0      128                                     :::59122                                                 :::*                    
tcp   LISTEN     0      100                                    ::1:smtp                                                  :::*                    

I could see that it has "closed 11254" , wondering if it's normal or something i need to worry & tune settings on the host . Need your suggestions on this .


In your listing the timewait count is what makes the most of the closed count.

You have a number of TIME-WAIT sockets (from the perspective of application they are indeed closed), but no need to worry. Most applications deal with these with SO_REUSEADDR socket option, so the TIME-WAIT sockets will simply be reused if system runs out of local port numbers.

The lack of SO_REUSEADDR will become apparent anyway, because the application will tell you EADDRINUSE "Address already in use".

The canonical SO answer on TIME-WAIT state and SO_REUSEADDR