View the number of concurrent connections in Nginx (interface and command)

Source: Internet
Author: User

1. View

The status module must be enabled for Nginx during web interface viewing, that is, when Nginx is installed

With-http_stub_status_module

Configure Nginx. conf and add the following content to the server:

1 2 3 4 5 Location/status {stub_status on; access_log/usr/local/nginx/logs/status. log; auth_basic "NginxStatus ";}

After configuring Nginx, you can access http: // localhost/status in the browser to view the following information:
Nginx load command

1 2 /Usr/local/nginx/sbin/nginx-t # Check whether the configuration file is incorrect/usr/local/nginx/sbin/nginx-s reload # reload the configuration file

View the result description:

1 2 3 4 5 Active connections // number of Active connections currently being processed by Nginx. server accepts handledrequests // processes a total of 5823 connections, successfully creates 5823 handshakes, and processes a total of 7806 requests. reading // Number of headers that nginx reads to the client. writing // Number of headers that nginx returns to the client. waiting // when keep-alive is enabled, this value is equal to active-(reading + writing), meaning Nginx has processed the resident connection Waiting for the next request command.

2. View through commands

View commands

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

Result

1 2 3 4 5 6 7 TIME_WAIT 17 ESTABLISHED 3254 LAST_ACK 236 FIN_WAIT_1 648 FIN_WAIT_2 581 CLOSING 7 CLOSE_WAIT 4916

Result description

1 2 3 4 5 6 7 8 9 10 11 CLOSED // No connection is active or LISTEN is in progress // the server is waiting for the incoming call SYN_RECV // a connection request has arrived, waiting for confirmation that SYN_SENT // The application has started, open a connection to ESTABLISHED // normal data transmission status/current number of concurrent connections FIN_WAIT1 // The application says it has completed FIN_WAIT2 // the other side has agreed to release ITMED_WAIT // wait until all groups die CLOSING // both sides attempt to disable TIME_WAIT at the same time // the other side has initialized a release LAST_ACK // wait until all groups die

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.