Httpd worker MPM Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 19: Line 19:
The maximum number of active child processes is determined by the MaxClients directive divided by the [[Httpd_worker_MPM_Configuration#ThreadsPerChild|ThreadsPerChild]] directive.
The maximum number of active child processes is determined by the MaxClients directive divided by the [[Httpd_worker_MPM_Configuration#ThreadsPerChild|ThreadsPerChild]] directive.


Two directives set hard limits on the number of active child processes and the number of server threads in a child process, and can only be changed by fully stopping the server and then starting it again: [[Httpd_worker_MPM_Configuration#ServerLimit|ServerLimit]] is a hard limit on the number of active child processes, and must be greater than or equal to the MaxClients directive divided by the [[Httpd_worker_MPM_Configuration#ThreadsPerChild|ThreadsPerChild]] directive. [[Httpd_worker_MPM_Configuration#ThreadLimit|ThreadLimit]] is a hard limit of the number of server threads per child process, and must be greater than or equal to the ThreadsPerChild directive. If non-default values are specified for these directives, they should appear before other worker directives.
Two directives set hard limits on the number of active child processes and the number of server threads in a child process, and can only be changed by fully stopping the server and then starting it again: [[Httpd_worker_MPM_Configuration#ServerLimit|ServerLimit]] is a hard limit on the number of active child processes, and must be greater than or equal to the MaxClients directive divided by the [[Httpd_worker_MPM_Configuration#ThreadsPerChild|ThreadsPerChild]] directive. [[Httpd_worker_MPM_Configuration#ThreadLimit|ThreadLimit]] is a hard limit of the number of server threads per child process, and must be greater than or equal to the ThreadsPerChild directive. ''If non-default values are specified for these directives, they should appear before other worker directives.''


ServerLimit is a hard limit (can only be changed by fully stopping the server) of ''active'' child processes.
ServerLimit is a hard limit (can only be changed by fully stopping the server) of ''active'' child processes.

Revision as of 02:10, 2 January 2017

Internal

Overview

When configured in worker MPM mode, the httpd web server functions as a hybrid multi-process/multi-threaded web server. The server uses multiple O/S processes, each of them running multiple threads, to serve requests.

Worker MPM support has be be explicitly compiled into the binary, it is not available by default. See the "Compilation" section to learn how to configure httpd with worker support and how to check whether worker support has been correctly installed.

A single control process (the parent) is responsible for launching child processes. Each child process creates a fixed number of server threads as specified in the ThreadsPerChild directive, as well as a listener thread which listens for connections and passes them to a server thread for processing when they arrive. The configuration elements described below are represented on the mod_jk Concepts Diagram.

httpd always tries to maintain a pool of spare or idle server threads, which stand ready to serve incoming requests. In this way, clients do not need to wait for a new threads or processes to be created before their requests can be served. The number of processes that will initially launched is set by the StartServers directive. During operation, httpd assesses the total number of idle threads in all processes, and forks or kills processes to keep this number within the boundaries specified by MinSpareThreads and MaxSpareThreads. Since this process is very self-regulating, it is rarely necessary to modify these directives from their default values.

What happens if all processes have at least an active threads, at any time? Does Apache has a mechanism that marks a process for shut down and let it bleed of active requests?

The maximum number of clients that may be served simultaneously (i.e., the maximum total number of threads in all processes) is determined by the MaxClients directive.

The maximum number of active child processes is determined by the MaxClients directive divided by the ThreadsPerChild directive.

Two directives set hard limits on the number of active child processes and the number of server threads in a child process, and can only be changed by fully stopping the server and then starting it again: ServerLimit is a hard limit on the number of active child processes, and must be greater than or equal to the MaxClients directive divided by the ThreadsPerChild directive. ThreadLimit is a hard limit of the number of server threads per child process, and must be greater than or equal to the ThreadsPerChild directive. If non-default values are specified for these directives, they should appear before other worker directives.

ServerLimit is a hard limit (can only be changed by fully stopping the server) of active child processes.

Configuration

worker MPM Configuration




TODO, copy over from https://home.feodorov.com:9443/wiki/Wiki.jsp?page=HttpdWorkerMPM