Maximum process of linux + apache

Source: Internet
Author: User
Linux + apache's largest process-Linux Enterprise Application-Linux server application information. The following is a detailed description. The maximum number of processes allowed for requests in Apache is 256, and the limit of MaxClients is 256. if there are more users, you can only see Waiting for reply .... wait until the next available process appears. The maximum number is determined by the Apache program-its NT Version can have 1024, but the Unix version only has 256. You can see in src/include/httpd. h:

# Ifndef HARD_SERVER_LIMIT
# Ifdef WIN32
# Define HARD_SERVER_LIMIT 1024
# Else
# Define HARD_SERVER_LIMIT 256
# Endif
# Endif
You can tune it to 1024 and then compile your system. Remember to change the configuration in httpd. conf. The default value is 150. For the following machines, the system will be unable to cope with the death of 512.

In addition, some systems limit the maximum number of processes of a user. You can use ulimit-u. Linux is generally 256. So if you really want Apache to exceed this number, you have to adjust this parameter:
Ulimit-u unlimited
This parameter must be modified before Apache runs. Therefore, it is recommended to add it to apachectl:
Case $ ARG in
Start)
If [$ RUNNING-eq 1]; then
Echo "$0 $ ARG: httpd (pid $ PID) already running"
Continue
Change
Case $ ARG in
Start)
Ulimit-u unlimited
If [$ RUNNING-eq 1]; then
Echo "$0 $ ARG: httpd (pid $ PID) already running"
You can set continue on your own.
For example, if DEBIAN + APACHE2 is used, set the file to the/etc/apache2 directory:

#>; Vi/etc/apache2/apache2.conf
Find the following statement to modify:

# MaxKeepAliveRequests: The maximum number of requests to allow
# During a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.

MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from
# Same client on the same connection.

KeepAliveTimeout 15

##
# Server-Pool Size Regulation (MPM specific)
##

# 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 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 20
MaxRequestsPerChild 0
;
It depends on your own version.
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.