View the number of concurrent apache requests and their TCP connection status

伊谢尔伦
Release: 2016-11-25 15:18:02
Original
1476 people have browsed it

In the past two days, I have built a set of Apache servers. Each server has 4G memory and uses prefork mode. The number of connections set at the beginning was too few and it took a long time to respond to user requests. Later, I modified Apache 2.0 .59 configuration file httpd.conf:

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers         10
MinSpareServers      10
MaxSpareServers      15
ServerLimit          2000
MaxClients           2000
MaxRequestsPerChild  10000
Copy after login

View the number of httpd processes (that is, the number of concurrent requests that Apache can handle in prefork mode):
Linux command:

ps -ef | grep httpd | wc -l
Copy after login

Return result example:
1388
means Apache can handle 1388 Concurrent requests, this value Apache can automatically adjust according to the load. The peak value of each server in my group has reached 2002.

View the number of concurrent requests of Apache and its TCP connection status:
Linux command:

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

Return result example:
LAST_ACK 5
SYN_RECV 30
ESTABLISHED 1597
FIN_WAIT1 51
FIN_WAIT2 504
TIME_WAIT 1057
The SYN_RECV indicates waiting The number of requests processed; ESTABLISHED indicates the normal data transmission status; TIME_WAIT indicates the number of requests that have been processed and are waiting for the timeout to end.

Status: Description
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 been started, opening a connection
ESTABLISHED: Normal data Transmission status
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 are trying to close at the same time
TIME_WAIT: The other side has initialized a release
LAST_ACK: Waiting for all packets to die

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!