Control Apache CPU, Memory, and Processes with httpd.conf

The following Apache HTTPD directives are for controlling processes launched by Apache children. Raising the maximum resource limit requires that the server is running as root, or in the initial startup phase. They apply to processes forked off from Apache children servicing requests, not the Apache children themselves. This includes CGI scripts and SSI exec commands, but not any processes forked off from the Apache parent such as piped logs.

Please check out the following article if you aren’t familiar with what this stuff does: Optimizing Servers and Processes for Speed with ionice, nice, ulimit.

RLimitMEM

Limits the memory consumption.
Sets the soft resource limit for all processes and the second parameter sets the maximum resource limit.
View the RLimitMEM Documentation

RLimitCPU

Limits the CPU consumption.
View the RLimitCPU Documentation

RLimitNPROC

Limits the number of processes that can be launched by processes launched by Apache children.
View the RLimitNPROC Documentation

Sets the soft resource limit for all processes and the second parameter sets the maximum resource limit. Either parameter can be a number, or max to indicate to the server that the limit should be set to the maximum allowed by the operating system configuration. Process limits control the number of processes per user. If CGI processes are not running under user ids other than the web server user id, this directive will limit the number of processes that the server itself can create. Evidence of this situation will be indicated by cannot fork messages in the error_log.


Comments

Leave a comment