Apache - Performance

No arquivo de configuração httpd.conf existem vários parametros dentre eles podemos destacar os parametros:

No UNIX e Linux:
StartServers
MaxClients
MaxSpareServers / MinSpareServers
MaxRequestsPerChild

No Windows NT:
ThreadsPerChild

Em todos os sistemas operacionais:
KeepAlive
KeepAliveTimeout
MaxKeepAliveRequests

Para cada um deles, os parametros adequados são:

StartServers: configura o numero de processos filhos criados quando o Oracle HTTP Server é iniciado. O default é 5.
MaxClients: Limits the number of requests that are handled simultaneously. The default value is 150.
MaxRequestsPerChild: Each child version handles this number of requests and then dies. If the value is 0, the process lasts until the machine is rebooted. The default value is 30.
MaxSpareServers: No more than this number of child servers should be left running and unused. The default value is 10.
MinSpareServers: At least this number of child servers should be kept functional. The default value is 5. If fewer than this number exist, new ones are started at an increasing rate each second until the rate defined by MAX_SPAWN_RATE is reached (default: 32).

For example, if the number of requests to be handled simultaneously is 100, and the number of child server processes created is 10, then the maximum number of requests to be handled per child can be 10

Dicas interessantes sobre o OHS

ThreadsPerChild: This directive sets the number of threads created by each child process. The child creates these threads at startup and never creates more.

If you are using an MPM like mpm_winnt, where there is only one child process, this number should be high enough to handle the entire load of the server.

If you are using an MPM like mpm_worker, where there are multiple child processes, the total number of threads should be high enough to handle the common load on the server.

MinSpareThreads: This value is only used with mpm_worker. Since Oracle Access Manager plug-in initialization is deferred until the first request, there is minimal advantage of keeping high value for this directive.

However, it is useful to keep this parameter as high as possible.

MaxSpareThreads: This value is only used with mpm_worker. The value for MaxSpareThreads must be greater than or equal to the sum of MinSpareThreads and ThreadsPerChild or the Apache HTTP Server automatically corrects it.

Recommendation: Keep the value high. For a dedicated server this will not be a problem.

MaxSpareServers: With Apache v2, this is used only with the prefork MPM model. To preserve as much state as possible in the server, set the MaxSpareServers to a high value. Setting this value to the maximum of 255 keeps all Apache worker-processes available indefinitely, but it does not provide an opportunity for worker-process recycling during low-load periods.

MinSpareServers: With Apache v2, this is used only with the prefork MPM model. Since Oracle Access Manager plug-in initialization is deferred until the first request, using a high value for the MinSpareServers parameter provides minimal advantage.

However, it is useful to keep this parameter as high as possible. For dedicated Web server systems, this should pose no great burden.

MaxClients: With IHS v2 and the worker MPM, MaxClients restricts the total number of threads that will be available to serve clients.

For hybrid MPMs, the default value is 16 (ServerLimit) multiplied by a value of 25 (ThreadsPerChild). To increase MaxClients to a value that requires more than 16 processes, you must also raise ServerLimit.


Os valores abaixo sao os recomendados para a maioria dos sites:

Recommended values that are sufficient for most sites:

MinSpareServers 5
MaxSpareServers 10

StartServers 5

Na grande maioria das instalacoes a recomendaçao é definir keepalive como OFF
KeepAlive OFF

Comentários