How to optimize Apache heavy load server

Source: Internet
Author: User
It is true that 20 thousand requests per day are not large, but if they are presented during peak hours, and they are not displayed in the evening or at other times, they are normally distributed and all download services require time, the load is huge. It is true that 20 thousand requests per day are not large, but if they are presented during peak hours, and they are not displayed in the evening or at other times, they are normally distributed and all download services require time, the load is huge.

The maximum number of processes that Apache promises to open for pleading 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 is displayed. The maximum number is determined by the Apache program-its NT version can have 1024, but the Unix version only has 256, you can in src/include/httpd. h
See:
# 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 that in httpd. conf
To change the configuration, the default value is 150. For the following machine, adjust to the top 512
Death, if it is higher, the system can not stand.

In addition, some systems limit the maximum number of processes for a user. You can use ulimit-u
Let's see. Linux is generally 256. So if you really want Apache to exceed this number, you have to adjust it.
This parameter:
Ulimit-u unlimited
This parameter must be corrected before Apache runs. Therefore, we recommend that you add this parameter 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'
Continue

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.