Alibaba Cloud Server uses OneinStack's lnmp one-click installation package to check the number of nginx concurrency

WBOY
Release: 2016-07-29 09:07:51
Original
1430 people have browsed it

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

1

2

3

4

5

6

7

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

TIME_WAIT 2126

FIN_WAIT1 137

FIN_WAIT2 1119

ESTABLISHED 5956

SYN_RECV 4

LAST_ACK 54

Resolution:
CLOSED //No connection is active or in progress
LISTEN //The server is waiting for an incoming call
SYN_RECV //A connection request has arrived, waiting for confirmation
SYN_SENT //The application has Start, open a connection
ESTABLISHED //Normal data transfer 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 //Waiting for all packets to die
CLOSING //Both sides At the same time, try to close
TIME_WAIT //The other side has initialized a release
LAST_ACK //Waiting for all groups to die

2, Nginx needs to open the status module when viewing it through the web interface,

OneinStack The lnmp one-click installation package is installed by default status module (that is, added when installing Nginx --with-http_stub_status_module), open /usr/local/nginx/conf/nginx.conf, you can see

location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1 ;
              deny all;
}

By default, it cannot be accessed through the external network,

wget 127.0.0.1/ngin on the server You can see concurrency after x_status

tail nginx_status
Active connections: 343
server accepts handled requests
317994 317994 599211
Reading: 0 Writing: 7 Waiting: 336

Analysis:
Active connections //The number of active connections currently being processed by Nginx.
server accepts handled requests //A total of 8 connections were processed, 8 handshakes were successfully created, and a total of 500 requests were processed.
Reading //nginx reads the number of header information from the client.
Writing //Nginx returns the number of Header information to the client.
Waiting //When keep-alive is turned on, this value is equal to active - (reading + writing), which means that Nginx has finished processing the resident connection that is waiting for the next request command

The above introduces the Alibaba Cloud server's use of OneinStack's lnmp one-click installation package to check the number of nginx concurrency, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template