Introduction and application of three MPM models of Apache

Source: Internet
Author: User

MPM is an Apache multi-channel processing module that defines how Apache handles client requests. The three MPM models commonly used in Linux are prefork, worker, and event.

Prefork:

A pre-build process in which a request responds with a process. The Apache2.2 version uses the Prefork model by default. Advantages: Stable and reliable, high execution efficiency, the collapse of any one process will not affect other requests. Disadvantage: The server resource consumption is serious when the concurrency is large.

Worker

Based on threading, one process generates multiple threads, and one request responds with one thread. Because of the use of thread access, multiple threads share resources for the same process, and if one process accesses a file and opens it, another thread does not have to open it again. Advantages: In high concurrency situations, The resource consumption of the server is much smaller than the prefork model. Disadvantage: The execution efficiency, the stability is inferior to the Prefork model. Linux is not a natively supported threading operating system, and has been tested to show that the worker model is not as comprehensive as the Prefork model on Linux.

Event

Event-driven processing model, A process processes multiple requests. The first two models, when a long connection is turned on, are to keep an entire process or thread waiting for the client's request, and in high concurrency this mechanism will quickly consume the server's available processes. The event model is simply the division of threads, using a dedicated process to listen for sockets to remain connected, because the listener The minimum amount of resources required to receive and maintain TCP connections a process can handle a large number of such requests. The event model is just a test model on apache2.2, and the event model is already used by default on 2.4. The event model that needs attention is no longer working under HTTPS access .


View the current server above the Apache loaded MPM module using the httpd-l command, which I loaded here is prefork! The system default

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6C/4B/wKioL1VFrojiPNYPAAByJtH6d3k918.jpg "title=" QQ picture 20150503130641.png "alt=" Wkiol1vfrojipnypaabyjth6d3k918.jpg "/>

To see which models httpd support on the current server, you can rpm-ql httpd | grep bin

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/4B/wKioL1VFrv7hISb5AAGFR1-Couk932.jpg "title=" QQ picture 20150503131003.png "alt=" Wkiol1vfrv7hisb5aagfr1-couk932.jpg "/>

To change the MPM model edit/ETC/SYSCONFIG/HTTPD This file

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/4F/wKiom1VFrxzwX5UlAAEy83dvUb4882.jpg "title=" QQ picture 20150503131637.png "alt=" Wkiom1vfrxzwx5ulaaey83dvub4882.jpg "/>

To use the worker model, remove the line of comments that the arrows refer to! Similarly, if you want to use the event model, change the back to an event.


This article is from the "left-handed" blog, make sure to keep this source http://mofeihu.blog.51cto.com/1825994/1641395

Introduction and application of Apache three MPM model

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.