Home > Backend Development > PHP Tutorial > How to set the number of concurrent apache_PHP tutorial

How to set the number of concurrent apache_PHP tutorial

WBOY
Release: 2016-07-13 09:55:57
Original
1157 people have browsed it

How to set the concurrent number of apache

Slow website response is not necessarily a problem with the program or database. If there is a problem with the concurrent number of apache, it will also lead to excessive website traffic. When requests are particularly slow or fail, how do you set the number of concurrent apache requests?

1. Modify the httpd.conf file

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

Remove the # comment in the above sentence

2. Determine what MPM mode the current apache is (winnt mode, perfork mode, worker mode)

Enter the apache/bin directory

cmd command: httpd.exe -1

How to set the number of concurrent apache_PHP tutorial

Note: Look at mpm_xxx.c. If xxx is winnt, it means winnt. It may also be perfork 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

ThreadsPerChild 150 //Just modify this value
MaxRequestsPerChild 0

4. Restart apache and test it

Under Linux, the generally used MPM is perfork mode

StartServers 5 5 //Start 5 processes in advance
MinSpareServers 5 5 //Minimum idle process
MaxSpareServers 10 //Maximum idle process
MaxClients 150 //Number of concurrent connections
MaxRequestsPerChild 0   //Refers to how many threads can be started in a process, which is better for workers, 0 means no limit

Give you a reasonable recommended configuration. For some websites and medium-sized websites, the configuration is:


StartServers 5 5 //Start 5 processes in advance
MinSpareServers 5 5 //Minimum idle process
MaxSpareServers 10 //Maximum idle process
ServerLimit 1500 // Used to modify apache programming parameters
MaxClients 1000 //Number of concurrent connections
MaxRequestsPerChild 0   //Refers to how many threads can be started in a process, which is better for workers, 0 means no limit

If your website’s pv is worth millions, you can set it like this:

ServerLimit 2500 // Used to modify apache programming parameters
MaxClients 2000 //Number of concurrent connections

Articles you may be interested in

  • How to set up phpmyadmin to automatically log in and cancel automatic login
  • php parse url (parse_url) parameters into an array (parse_str)
  • How to set the DIV layer to be displayed on top of the flash object, compatible with browsers such as IE and Firefox
  • php function to calculate the current week of the year or month
  • The jquery setting button is not clickable to prevent repeated submission of data
  • mysql queue to achieve efficient concurrent reading of data
  • How to set default parameter values ​​for functions in Javascript
  • javascript Method to implement replaceall (global match and replace)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/991317.htmlTechArticleHow to set the concurrent number of apache. The slow response of the website is not necessarily a problem with the program or database. There is a problem with the concurrent number of apache. This will also cause the website to have too many visits...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template