To view the number of Apache concurrent requests and their TCP connection status

Source: Internet
Author: User
These two days to build a set of Apache server, each server 4G of memory, using the Prefork mode, initially set up a few connections, it takes a long time to respond to the user's request, and then modified the Apache 2.0.59 configuration file httpd.conf:

# prefork mpm# startservers:number of server processes to start# minspareservers:minimum number of server processes whic H is kept spare# maxspareservers:maximum number of server processes which is kept spare# maxclients:maximum number of Server processes allowed to start# maxrequestsperchild:maximum number of requests a server process servesstartservers
  
   10minspareservers      10MaxSpareServers      15ServerLimit          2000MaxClients           2000MaxRequestsPerChild  10000
  

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

Ps-ef | grep httpd | Wc-l

Examples of returned results:
1388
Indicates that Apache can handle 1388 concurrent requests, which Apache can automatically adjust according to the load, and the peak of each of my set of servers has reached 2002.

To view the number of concurrent requests for Apache and its TCP connection status:
Linux commands:

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

Examples of returned results:
Last_ack 5
SYN_RECV 30
Established 1597
Fin_wait1 51
Fin_wait2 504
Time_wait 1057
Where SYN_RECV indicates the number of requests being processed, established indicates normal data transfer status, time_wait indicates the number of requests that have been processed, waiting for the end of the timeout.

Status: 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

  • 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.