Apache's working mode

Source: Internet
Author: User
Tags epoll

Apache's working mode

1.apache Three modes of Operation
we all know that Apache has three types of work modules, prefork, worker, event, respectively.
prefork: Multi-process , each request with a process response, this process will use the Select mechanism to notify.
Worker: Multi-threaded , a process can generate multiple threads, each thread responds to a request, but the notification mechanism is select but can accept more requests.
Event : Based on the asynchronous I/O model , a process or thread, each process or thread responds to multiple user requests, and is implemented based on the event-driven (that is, the epoll mechanism).

How the 2.prefork works
If you do not explicitly specify a mpm,prefork with "--with-mpm", it is the default MPM on the UNIX platform. The pre-derived subprocess that it uses is also the pattern used in Apache1.3. Prefork itself is not used to threads, Version 2.0 is used to maintain compatibility with version 1.3, and on the other hand, prefork processes different requests with separate sub-processes, and the process is independent of each other, making it one of the most stable mpm.

How the 3.worker works
compared to Prefork,worker is the new MPM in version 2.0 that supports multi-threaded and multi-process hybrid models. Because of the use of threads for processing, you can handle a relatively large number of requests, while system resources are less expensive than process-based servers. However, the worker also uses multiple processes, Each process generates multiple threads to obtain stability based on the process server. This mpm's way of working will be the trend of Apache2.0 development.

4.event feature based on event mechanism
a process responds to multiple user requests, uses the callback mechanism to make the socket reusable, requests that the process does not process the request, but directly to other mechanisms, through the epoll mechanism to inform whether the request is complete, and in this process, the process itself has been idle, You can always receive user requests. A process can be implemented to respond to multiple user requests. Supports a large number of concurrent connections and consumes less resources.

Apache's working mode

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.