View the number of current nginx and MySQL connections

Source: Internet
Author: User
View the total number of nginx connections and connection status:
# Netstat-N | awk '/^ TCP/{++ s [$ NF]} end {for (a in S) print a, s [a]}'

Time_wait 17

Established 3254

Last_ack 236

Fin_wait_1 648

Fin_wait_2 581

Closing 7

Close_wait 4916

Description:

Closed // No connection is active or in progress

Listen // the server is waiting for the incoming call

Syn_recv // a connection request has arrived, waiting for confirmation

Syn_sent // The application has started. Open a connection.

Established // normal data transmission status/current number of concurrent connections

Fin_wait1 // The application says it has been completed

Fin_wait2 // the other side has agreed to release

Itmed_wait // wait until all groups die

Closing // both sides attempt to close at the same time

Time_wait // the other side has initialized a release

Last_ack // wait until all groups die

View the current MySQL connection:

1. view the details of all current connections:

./Mysqladmin-uadmin-p-h10.140.1.1 processlist

2. view only the current number of connections (threads is the number of connections .):

./Mysqladmin-uadmin-p-h10.140.1.1 status

Note: (account differentiation)

View the number of MySQL connections and the number of MySQL connections of the current user

Log on to the MySQL prompt as an administrator.

# Mysql-uroot-pxxxx

Mysql> show processlist; the first 100 connections can be displayed. show full processlist; all connections can be displayed. Simply put, if you log on with a common account, only this user is displayed. Note that the command has a semicolon.

If you want to view the settings of this server. # Vi/etc/My. CNF

Set-variable = max_user_connections = 30. This is the number of connections of a single user.

Set-variable = max_connections = 800 this is the global limit on the number of connections

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.