Analysis of MPM in Apache

Source: Internet
Author: User

1. What is MPM?
Multi-Processing Module (MPM) implements a hybrid multi-process multi-threaded server. (Multi-process, multi-threaded)

2, how many kinds of MPM?
Roughly: Prefork mpm, worker MPM, BeOS mpm, NetWare mpm, Os/2 mpm, WinNT mpm.

3. How to know which MPM is currently used by Apache?
Both Linux and Windows can be queried using the command: "Httpd-l".

4. How does each MPM work and how to optimize it?
(1) Prefork MPM
<ifmodule mpm_prefork_module>
Startservers 10
Minspareservers 10
Maxspareservers 15
Serverlimit 2000
MaxClients 1000
Maxrequestsperchild 10000
</IfModule>
The Startservers child process is established at startup,
Then create the number of processes per second until the minspareservers process is reached (up to 32 per second),
If the number of idle processes is greater than maxspareservers, check kill some idle processes.
MAXREQUESTPERCHILD specifies how many requests each process processes to self-destruct.
maxclients Specifies the maximum number of requests that Apache can process concurrently, that is, the number of processes?
MaxClients default cannot be greater than 256, you can set Serverlimit to increase the limit, the maximum 20000?

(2) Worker:
<ifmodule mpm_worker_module>
Startservers 3
MaxClients 2000
Serverlimit 25
Threadlimit 200
Threadsperchild 100
Minsparethreads 50
Maxsparethreads 200
Maxrequestsperchild 0
</IfModule>
The Startservers child process is established at startup,
Each process contains threadsperchild threads, with a default maximum of 64
Minsparethreads defines the minimum number of idle threads, maximum 75
Maxsparethreads defines the maximum number of idle threads to perform cleanup? Maximum 250
MaxClients defines the total number of threads in all child processes
Threadlimit, Max 20000, default 64
Serverlimit, maximum value 20000, default 16
It is important to note that if Serverlimit is explicitly declared, then it must be multiplied by the value of threadsperchild to be greater than or equal to maxclients, and maxclients must be an integral multiple of threadsperchild, Otherwise, Apache will automatically adjust to a corresponding value (possibly a non-expectation).

(3) WinNT MPM:
<ifmodule mpm_winnt_module>
Threadsperchild 500
Maxrequestsperchild 10000
</IfModule>
MPM_WINNT.C is dedicated to Windows NT-optimized MPM (multi-processing module), which uses a separate parent process to produce a separate subprocess that, in turn, produces multiple threads in this subprocess to process requests. This means that mpm_winnt can only start a parent-child two process and not start multiple processes at the same time as Linux.
Threadlimit, default 1920, Max 15000, limits the total number of threads for a single process.


This article is from the Linux Essentials blog, so be sure to keep this source http://chaoyuezhangsan.blog.51cto.com/7176886/1854714

Analysis of MPM in Apache

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.