View the number of TCP concurrent connections in apache

Source: Internet
Author: User
View the number of TCP concurrent connections in apache-Linux Enterprise Application-Linux server application information. The following is a detailed description. A group of Apache servers have been built over the past two days. Each server has 4 GB of memory and adopts the prefork mode. The number of connections set at the beginning is too small, it took a long time to respond to the user's request. Later, I modified the configuration file httpd of Apache 2.0.59. 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

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

Linux Command:
Ps-ef | grep httpd | wc-l

Return result example: 1388

It indicates that Apache can process 1388 concurrent requests. Apache can automatically adjust this value based on the load. The peak value of each server in my group has reached 2002.

View the number of concurrent Apache requests and their TCP connection status:
Linux Command:
Netstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) print a, S [a]}'

(This statement was obtained from Wang dawang, Technical Director of Sina interactive community division. It is very good)

Sample returned results:
LAST_ACK 5
SYN_RECV 30
ESTABLISHED 1597
FIN_WAIT1 51
FIN_WAIT2 504
TIME_WAIT 1057

SYN_RECV indicates the number of requests waiting for processing, ESTABLISHED indicates the normal data transmission status, and TIME_WAIT indicates the number of requests waiting for timeout.
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.