How to optimize Apache heavy load Server

Source: Internet
Author: User
Article Title: how to optimize Apache heavy load server. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
20 thousand requests per day are not large, but if they occur during peak hours and are not available at night or other times, they are normally distributed and all download services require time, the load is huge.
  
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 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
If it is higher, the system will not be able to stand it.
  
In addition, some systems limit the maximum number of processes of 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 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"
Continue
  
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.