Performance Optimization of Apache in Windows-mpm

Source: Internet
Author: User
Link: http://fanlb.blogbus.com/logs/119081614.html

In general, IIS is used in winnt systems, while Apache has many applications in Linux, but many people still use Apache rather than IIS In winnt systems, it may be based on familiarity with Windows systems. Today, we will discuss how to optimize Apache performance in windows.

Run "httpd-L" to check which MPM module is loaded in the Windows + Apache + PhP environment. The following is the mpm_winnt.c, so we changed the settings in mpm_winnt.c during optimization.

Mpm_winnt.cMPM (Multi-Channel Processing Module) is specially optimized for Windows NT. It uses a separate parent process to generate a separate sub-process, in this sub-process, multiple threads are generated in turn to process requests. That is to say, mpm_winnt can only start two processes: Parent and Child. It cannot start multiple processes at the same time as in Linux.

Mpm_winnt optimizes Apache through the threadsperchild and maxrequestsperchild parameters. The following describes in detail.

Threadsperchild
This parameter is used to set the number of threads for each process. When a sub-process is started, these threads are created and no new threads are created. on the one hand, because mpm_winnt cannot start multiple processes, this value must be large enough to handle possible request peaks. On the other hand, this parameter is subject to the server response speed, if the number is too large, it slows down. Therefore, a reasonable value must be balanced comprehensively.

The default value on mpm_winnt is 64, and the maximum value is 1920. We recommend that you set the value between and. If the server performance is high, the value is larger. Otherwise, the value is smaller.

Maxrequestsperchild
This parameter table shows the maximum number of requests that each sub-process can process, that is, the number of sub-processes in the same time. If it is set to 0, it indicates no limit. The default value on mpm_winnt is 0.

It is not recommended to set the value to 0 in the official reference manual. It is mainly based on two considerations: (1) it can prevent (accidental) unlimited memory leakage and thus exhaust the memory; (2) A limited life cycle is provided for processes, which helps reduce the number of active processes when server load is reduced.

Therefore, the value of this parameter depends more on the server memory. If the memory is large, you can set it to 0 or a large number. Otherwise, you can set a small value. It should be noted that if this value is set too small, Apache will frequently restart and the following text will be displayed in the log file:

Process exiting because it reached maxrequestsperchild. signaling the parent

This reduces the overall performance of Apache.

In addition, you can check the server-status (Status Report) provided by Apache to verify whether the currently set value is reasonable. In the httpd. conf file, make the following settings to open it:

  1. # First load the mod_status module
  2. Loadmodule status_module modules/mod_status.so
  3. # Set the access address
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.