Number of Linux concurrent connections view

Source: Internet
Author: User

1. View the number of concurrent requests for Webserver (Nginx Apache) and their TCP connection status:


Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '

Netstat-n|grep ^tcp|awk ' {print $NF} ' |sort-nr|uniq-c

Or:
Netstat-n | awk '/^tcp/{++state[$NF]} END {for (key in) print key, "T", State[key]} '
The returned results are generally as follows:

Last_ack 5 (number of requests waiting to be processed)
SYN_RECV 30
Established 1597 (normal transfer data status)
Fin_wait1 51
Fin_wait2 504
TIME_WAIT 1057 (processing completed, number of requests waiting for timeout to expire)

Other parameters:

CLOSED: No connection is active or in progress
Listen:server waiting to enter the call
SYN_RECV: A connection request has arrived, waiting for confirmation
Syn_sent: Application has started, open a connection
Established: normal transfer of data status
FIN_WAIT1: Application says it's finished
Fin_wait2: And one side has been allowed to release
Itmed_wait: Waiting for all groups to die
CLOSING: Try to close both sides at the same time
Time_wait: And one side has initialized a release
Last_ack: Waiting for all groups to die

2. View the number of nginx execution processes
Ps-ef | grep Nginx | Wc-l
The number returned is the number of nginx execution processes, assuming that Apache executes the
Ps-ef | grep httpd | Wc-l

3. View the number of webserver process connections:
NETSTAT-ANTP | grep 80 | grep established-c


Number of Linux concurrent connections view

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.