Apache MPM Worker

xiaoxiao2021-03-06  42

Apache MPM Worker

Description: Multi-threaded multi-process modules for network servers

Status: MPM

Module Name: MPM_WORKER_MODULE

Source file: worker.c

summary

This multi-channel processing module (MPM) allows the web server to support multi-threaded multi-threaded multi-threaded. Since the request is used to handle the request, the huge amount of request can be handled, and the overhead of the system resource is smaller than the process-based server. However, it also uses a multi-process, and each process has multiple threads to achieve the stability of a process-based server.

The most important instruction to control this MPM is to control the ThreadPerChild instructions for each child process allowing the number of threads to control, and control MaxClients that allows the total number of processes to be established.

How is it working?

The number of threads that can have in each process is fixed. The server will increase or reduce the adjustment of the number of processes based on load conditions.

A single control process is responsible for sub-process. Each child process can establish a fixed number of threads specified by ThreadsperChild. Then, the connection is listened and processed by a stand-alone thread.

Apache always tries to maintain a spare or idle service thread pool. Thus, the client can be processed without waiting for the establishment of threads or processes. The number of initial established processes is determined by the StartServers directive. Thereafter, Apache detects the total number of hollow threads in all processes, and new or ending processes to maintain the total number within the scope specified by MinSparethreads and MaxSpareThreads. Since this process is automatically adjusted, there is almost no need to modify the default value of these instructions. At the same time, the maximum number of clients that can be processed depends on the MaxClients directive, and the maximum number of process established depends on the ServerLimit command. ServerLimit must be greater than equal to MaxClients with ThreadsperChild.

The typical configuration of the process - thread control in the WORKER MPM is as follows:

STARTSERVERS 2

MaxClients 150

Minsparethreads 25

Maxsparethreads 75

ThreadsperChild 25

ServerLimit 16

In UNIX, in order to be able to bind port 80, the parent process is typically started as root, and thereafter, the Apache creates a sub-process and thread at a lower permissions. User and Group instructions are used to set permissions for the Apache sub-process. Although the sub-process must have read permissions on the content provided, it should be as small as possible. In addition, the permissions of these instructions set will be inherited by the CGI script unless SUEXEC is used.

The MaxRequestSperChild command is used to control the frequency of the server established and end the process.

转载请注明原文地址:https://www.9cbs.com/read-71291.html

New Post(0)