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