Configuring the Prefork MPM


StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0


You can control the number of processes that will be created at startup by using the StartServers directive. It takes a single argument, indicating the number of servers to fork when the server starts. The default value is 5 and is appropriate for most websites. You should change this setting only if you run a very busy website.

MaxClients enables you to control the maximum number of processes spawned, up to the operating system limits or Apache's maximum number of possible children. In Apache 1.3, the maximum number of possible children is hard coded to 256. To change this value, you will need to change the HARD_SERVER_LIMIT setting in httpd.h and recompile the server. In Apache 2, it can be changed in the configuration using the ServerLimit directive.

The MinSpareServers directive defines the minimum number of processes that can be idle (not serving any request) at any time. If the number of idle servers goes below the setting of MinSpareServers, Apache will spawn additional children. Conversely, MaxSpareServers sets the maximum number of idle processes allowed. If the number of idle servers grows beyond this setting, some of them will be killed. The default values, shown in the example, should be enough for most servers.

Finally, you can limit the number of requests that a specific process will serve using the MaxRequestsPerChild directive. It does not count multiple requests reusing the same connection. As explained earlier in the chapter, this is useful to prevent memory leaks from becoming an issue with processes that are running for a long time. The server will kill the process and replace it with a new one after the specified number of requests. You can set MaxRequestsPerChild to 0 if you do not want processes to be killed after a specific number of requests.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net