View the concurrent connections and connection status of Nginx Apache MySQL under Linux

Source: Internet
Author: User

1. View the number of concurrent requests for the Web server (Nginx Apache) and its TCP connection status:

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

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 data transfer status, can be understood as close to the number of concurrent connections)
Fin_wait1 51
Fin_wait2 504
Time_wait 1057 (number of requests processed, waiting for timeout to end)

Additional parameter 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, waiting for confirmation
Syn_sent: Application has started, open a connection
Established: Normal data transfer status
FIN_WAIT1: Application says it's done
Fin_wait2: The other side has agreed to release
Itmed_wait: Waiting for all packets to die
CLOSING: Both sides try to close simultaneously
Time_wait: The other side has initialized a release
Last_ack: Waiting for all packets to die

2. View the number of nginx concurrent processes
Ps-ef | grep Nginx | Wc-l
The number returned is Nginx is not the number of processes, if Apache is executed
Ps-ef | grep httpd | Wc-l

You can also use the following command:
Watch-n 1-d "Pgrep nginx|wc-l"

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

4. View the number of MySQL process connections:
Ps-axef | grep mysqld-c

View the concurrent connections and connection status of Nginx Apache MySQL under Linux

Related Article

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.