You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by rewt rewt <re...@linux-elite.org> on 2012/11/21 10:44:27 UTC

[users@httpd] MPM Worker settings calculation

Hello,
After many performances issues with mpm prefork (high memory) i would like
to use the MPM worker wich seems better for high traffic sites.
I have been able to estimate the RAM per httpd process in prefork around
25m.
With the prefork setting i have calculate MaxClients this way:
MaxClients = ((TOTAL_MEMORY -
MEMORY_USED_BY_HTTD)/MEDIUM_SIZE_OF_HTTPD_PROCESSES)-10%

It means that for a 8GB RAM server using arround 25M for each connections
with a system usage of around 1,5G i will have:
MaxClients=((8000000 - 2000000)/25000)-10%
MaxClients=216 (arround 220)

Correct, right ?

But now i want to use MPM worker (with FastCGI for PHP, APC and
mod_mem_cache (if it is possible ?)).
My issue is that i don't know how to calculate the settings for MaxClients,
ThreadPerChild, ThreadStackSize etc...
And the documentation even on the Apache site is not explained anywhere (as
far as i have seen)

I am using a VPS with 32Gb of RAM and 8 vCPU. (i d like to use haproxy as a
reverse proxy with 2 or 3 VPS like that in the backend)
The PHP app is using around 25m (calculated with  with prefork)

What could be the best setting with these value to have the maximum number
of request at the same time without issue ?
And so what will be the maximum MaxClients i can set with these value?

Many thanks in advance for your kind help.

Re: [users@httpd] MPM Worker settings calculation

Posted by Tom Evans <te...@googlemail.com>.
On Wed, Nov 21, 2012 at 9:44 AM, rewt rewt <re...@linux-elite.org> wrote:
> Hello,
> After many performances issues with mpm prefork (high memory) i would like
> to use the MPM worker wich seems better for high traffic sites.
> I have been able to estimate the RAM per httpd process in prefork around
> 25m.
> With the prefork setting i have calculate MaxClients this way:
> MaxClients = ((TOTAL_MEMORY -
> MEMORY_USED_BY_HTTD)/MEDIUM_SIZE_OF_HTTPD_PROCESSES)-10%
>
> It means that for a 8GB RAM server using arround 25M for each connections
> with a system usage of around 1,5G i will have:
> MaxClients=((8000000 - 2000000)/25000)-10%
> MaxClients=216 (arround 220)
>
> Correct, right ?
>
> But now i want to use MPM worker (with FastCGI for PHP, APC and
> mod_mem_cache (if it is possible ?)).
> My issue is that i don't know how to calculate the settings for MaxClients,
> ThreadPerChild, ThreadStackSize etc...
> And the documentation even on the Apache site is not explained anywhere (as
> far as i have seen)
>
> I am using a VPS with 32Gb of RAM and 8 vCPU. (i d like to use haproxy as a
> reverse proxy with 2 or 3 VPS like that in the backend)
> The PHP app is using around 25m (calculated with  with prefork)
>
> What could be the best setting with these value to have the maximum number
> of request at the same time without issue ?
> And so what will be the maximum MaxClients i can set with these value?
>
> Many thanks in advance for your kind help.

I don't know worker, we use event MPM. but it is somewhat similar in
that you have a number of worker threads spread across a number of
processes. We use these settings on our reasonably high traffic
reverse proxy:

# Each httpd child has 64 worker threads
ThreadsPerChild 64

# Start 8 children immediately for 512 workers
StartServers 8

# Have at most 16 servers
ServerLimit 16

# Start another child if we have less than 128 spare worker threads
MinSpareThreads 128

# Kill a child if we have more than 768 worker threads spare
MaxSpareThreads 768


With a threaded MPM, MaxClients is ServerLimit * ThreadsPerChild, so
this allows for 1024 max clients. Each httpd process has a maximum
SIZE of ~174M, and a RSS of around 75MB.

Depending upon how much memory you need to allocate to the PHP app,
and the proportion of hits that will require PHP you may need to scale
up/down - no point having 1024 httpd slots multiplexing to 10 PHP
workers if 90% of your requests require PHP.

Cheers

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] MPM Worker settings calculation

Posted by Eric Covener <co...@gmail.com>.
> My issue is that i don't know how to calculate the settings for MaxClients,
> ThreadPerChild, ThreadStackSize etc...
> And the documentation even on the Apache site is not explained anywhere (as
> far as i have seen)

Use defaults, measure the memory usage, and scale up MaxClients  and
ServerLimit if needed.  There's no reason to proactively change
anything else.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org