Search code examples
springspring-boottcp

How to know how many connections are connecting with SpringBoot website?


The SpringBoot website is deployed in Linux server, and its port number is 9010. We know that netstat is useful to check how many TCP connections are connected to the Linux server.

Now I want to know how many connections are connected with my website. I use command as below:

netstat -an | grep :9010 -c

There are so many connections here. And many of them are in status TIME_WAIT. I know this means that it is going to close.

If I am counting how many http requests SpringBoot is handling at the exact time, should I count the TIME_WAIT connections?

Can anyone give some clue? Thanks.


Solution

  • Maybe the question here is not very clear. "How many connections"? The connections can in various status. And often, many of them are in TIME_WAIT.

    Maybe I should say, if I want to know how many connections(web request) the Website is processing at the exacte timestap, I can use below comannd:

    netstat -an |grep -c 9010.*ESTABLISHED

    But if I want to know how many connections(web request) the website has processed around the timestamp(maybe in 60 seconds), I can use below command:

    netstat -an | grep :9010 -c

    Because TIME_WAIT means this request was processed short time ago(For simple, I don't count the Keep-Alive situation).

    Anyone has different opinions? Looking forward reply.