Linux using the netstat command to view the number of concurrent connections [go]

Source: Internet
Author: User

Our website is deployed on the Linux server, especially the Web server, we may sometimes as operations personnel, must be to see whether the number of concurrent connections to the site is not a bottleneck, so under Linux, how can we see the number of concurrent connections to the server? Use the following commands to view the various connection statuses in groups:

Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Explanation: Return Results Example: Last_ack 5   (number of requests waiting to be processed) SYN_RECV established 1597 (normal data transfer status) fin_wait1 Fin_wait2 504 time_wait 1057 ( The number of requests that have been processed, waiting for the timeout to expire)  Status: Description CLOSED: No connection is active or in progress LISTEN: The server is waiting to enter the call SYN_RECV: A connection request has arrived, wait for confirmation Syn_sent: The app has started, open a connection Established: Normal data transfer status FIN_WAIT1: The app says it's done Fin_wait2: the other side has agreed to release itmed_wait: Wait for all the packets to die CLOSING: Both sides simultaneously try to close time_ Wait: The other side has initialized a release last_ack: Wait for all packets to die

Using this command, you can view the server's connection status, where established is the number of concurrent connection status displays. If you don't want to see so many connected states, and just want to see the number of concurrent connections, you can simplify the command, namely:

Netstat-nat|grep established|wc-l
1164

The number returned is the current number of concurrent connections.

Linux using the netstat command to view the number of concurrent connections [go]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.