How to set the number of apache concurrent jobs

Source: Internet
Author: User

How to set the number of apache concurrent jobs

Slow website response is not necessarily a problem with programs or databases. If there is a problem with the apache concurrency setting, the request may be particularly slow or fail when the website traffic is too large, how can I set the number of apache concurrent jobs?

1. modify it in the httpd. conf file.

# Server-pool management (MPM specific)
# Include conf/extra/httpd-mpm.conf

Remove the # comment in the above sentence

2. determine the current MPM mode of apache (winnt mode, worker K mode, and worker mode)

Go to the apache/bin directory

Cmd command: httpd.exe-1

Note: mpm_xxx.c. If xxx is winnt, it indicates winnt. It may also be a worker K or worker.

3. Modify the httpd-mpm.conf File

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_winnt_module>
ThreadsPerChild 150 // modify the value.
MaxRequestsPerChild 0
</IfModule>

4. Restart apache and test it.

In Linux, the MPM mode is generally used.
<IfModule mpm_prefork_module>
StartServers 5 // start five processes in advance
MinSpareServers 5 // minimum idle Process
MaxSpareServers 10 // maximum number of idle Processes
MaxClients 150 // number of concurrent connections
MaxRequestsPerChild 0 // specifies the number of threads in a process, which is better for worker. 0 is not limited.
</IfModule>

Provide you with reasonable suggestions for some websites and medium-sized websites:

<IfModule mpm_prefork_module>
StartServers 5 // start five processes in advance
MinSpareServers 5 // minimum idle Process
MaxSpareServers 10 // maximum number of idle Processes
ServerLimit 1500 // used to modify apache programming parameters
MaxClients 1000 // number of concurrent connections
MaxRequestsPerChild 0 // specifies the number of threads in a process, which is better for worker. 0 is not limited.
</IfModule>

If your website has a pv of 1 million, you can set it as follows:

ServerLimit 2500 // used to modify apache programming parameters
MaxClients 2000 // number of concurrent connections

Articles you may be interested in
  • How to Set automatic phpmyadmin login and cancel Automatic Login
  • Php parses the url (parse_url) parameter into an array (parse_str)
  • How to set the DIV layer to display on a flash object, compatible with browsers such as ie and firefox
  • Php calculates the number of weeks in a year or January.
  • The jquery setting button cannot be clicked to prevent repeated data submission
  • Mysql queue for efficient Concurrent Data Reading
  • What is the default parameter value for function settings in Javascript?
  • How to Implement replaceall in javascript

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.