Movatterモバイル変換


[0]ホーム

URL:


Modules |Directives |FAQ |Glossary |Sitemap

Apache HTTP Server Version 2.4

<-
Apache >HTTP Server >Documentation >Version 2.4 >Modules

Apache MPM prefork

Available Languages: de  | en  | fr  | ja  | tr 

Description:Implements a non-threaded, pre-forking web server
Status:MPM
Module Identifier:mpm_prefork_module
Source File:prefork.c

Summary

This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server. Each server process may answer incoming requests, and a parent process manages the size of the server pool. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other.

This MPM is very self-regulating, so it is rarely necessary to adjust its configuration directives. Most important is thatMaxRequestWorkers be big enough to handle as many simultaneous requests as you expect to receive, but small enough to assure that there is enough physical RAM for all processes.

Support Apache!

Topics

Directives

Bugfix checklist

See also

top

How it Works

A single control process is responsible for launching child processes which listen for connections and serve them when they arrive. Apache httpd always tries to maintain severalspare or idle server processes, which stand ready to serve incoming requests. In this way, clients do not need to wait for a new child processes to be forked before their requests can be served.

TheStartServers,MinSpareServers,MaxSpareServers, andMaxRequestWorkers regulate how the parent process creates children to serve requests. In general, Apache httpd is very self-regulating, so most sites do not need to adjust these directives from their default values. Sites which need to serve more than 256 simultaneous requests may need to increaseMaxRequestWorkers, while sites with limited memory may need to decreaseMaxRequestWorkers to keep the server from thrashing (swapping memory to disk and back). More information about tuning process creation is provided in theperformance hints documentation.

While the parent process is usually started asroot under Unix in order to bind to port 80, the child processes are launched by Apache httpd as a less-privileged user. TheUser andGroup directives are used to set the privileges of the Apache httpd child processes. The child processes must be able to read all the content that will be served, but should have as few privileges beyond that as possible.

MaxConnectionsPerChild controls how frequently the server recycles processes by killing old ones and launching new ones.

This MPM uses thempm-accept mutex to serialize access to incoming connections when subject to the thundering herd problem (generally, when there are multiple listening sockets). The implementation aspects of this mutex can be configured with theMutex directive. Theperformance hints documentation has additional information about this mutex.

top

MaxSpareServersDirective

Description:Maximum number of idle child server processes
Syntax:MaxSpareServersnumber
Default:MaxSpareServers 10
Context:server config
Status:MPM
Module:prefork

TheMaxSpareServers directive sets the desired maximum number ofidle child server processes. An idle process is one which is not handling a request. If there are more thanMaxSpareServers idle, then the parent process will kill off the excess processes.

Tuning of this parameter should only be necessary on very busy sites. Setting this parameter to a large number is almost always a bad idea. If you are trying to set the value equal to or lower thanMinSpareServers, Apache HTTP Server will automatically adjust it toMinSpareServers + 1.

See also

top

MinSpareServersDirective

Description:Minimum number of idle child server processes
Syntax:MinSpareServersnumber
Default:MinSpareServers 5
Context:server config
Status:MPM
Module:prefork

TheMinSpareServers directive sets the desired minimum number ofidle child server processes. An idle process is one which is not handling a request. If there are fewer thanMinSpareServers idle, then the parent process creates new children: It will spawn one, wait a second, then spawn two, wait a second, then spawn four, and it will continue exponentially until it is spawning 32 children per second. It will stop whenever it satisfies theMinSpareServers setting.

Tuning of this parameter should only be necessary on very busy sites. Setting this parameter to a large number is almost always a bad idea.

See also

Available Languages: de  | en  | fr  | ja  | tr 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to ourmailing lists.

Copyright 2025 The Apache Software Foundation.
Licensed under theApache License, Version 2.0.

Modules |Directives |FAQ |Glossary |Sitemap


[8]ページ先頭

©2009-2025 Movatter.jp