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