I'm not sure how you understood it, but they're all separate
processes. The two totals should not be compared with each other.
> I think Im missing how the directives for both these servers affect
> each other.
>
> For Apache, im using the default prefork_mpm with the following
> settings
>
> StartServers - 5
> MinSpareServers - 5
> MaxSpareServers - 10
> MaxClients - 150
> MaxRequestsPerChild - 0
>
> I want to understand how these map to/affect Passenger's own
> directives listed below
They don't. The Apache MPM settings are totally disjoint from Phusion
Passenger's process management settings. With the MPM settings you're
just configuring how Apache itself is behaving.
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)
There is a pool of app processes. Whenever the web server receives a
request it checks out an app process from the pool and marks it as
busy. If all app processes in the pool are busy and the pool limit
hasn't been reached yet, then a new one will be spawned. The web
server then proceeds with communicating with the checked out app
process. This means that, as a rule, your web server's concurrency
level must be at least equal to PassengerMaxPoolSize, which is usually
the case. Setting your web server's concurrency level above
PassengerMaxPoolSize won't gain you any more performance or additional
concurrency as far as Phusion Passenger requests are concerned, but
may help you with other things like serving static assets.
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
It's defined entirely by the MPM settings like StartServers and stuff.
The number of Apache processes only indicates Apache's concurrency
level if you're using the prefork MPM. When using the worker MPM each
process can have multiple threads so the number of processes becomes
meaningless in that case.
>> And Passenger's spawn server, framework spawner and application
>> spawner are independent of these processes described above right? In
>> terms of memory usage that is.
Yes.
>> So typically, would you say that the following formula is good for a
>> single app running on a slice?
>>
>> (total private dirty for Apache processes) + (total private dirty for
>> Passengers spawn servers) + (PassengerMaxPoolSize * Private dirty per
>> app instance) should be = 80% of slice memory (with a leeway of 20%
>> for stuff like mysql, SSHing into the server, etc.)
Yes looks good as a general guideline. Things can vary depending on
your app or server so be sure to experiment with the values.
>> Some other clarifications, if you will, on the directives,
>>
>> 1. PassengerMaxInstancesPerApp is relevant only if you're running
>> multiple apps on the same slice. And if you are, it will always be
>> lesser than PassengerMaxPoolSize and probably a factor of it .. ?
Yes.
>> 2. PassengerPoolIdleTime can typically be set to infinite (0) for a
>> slice running a single app and configured with the above formula, so
>> that app instances are always ready to process client requests and the
>> app instance spawning time is saved .. ?
Yes.
>> 3. PassengerMaxRequests, again would typically be infinite (0) with
>> the given setup
Yes. It's actually only good for broken apps that leak memory and need
to be restarted once in a while.
> and PassengerStatThrottleRate wouldn't need to be
>> touched given that it is a dedicated slice for one app .. ?
Yes. StatThrottleRate is designed to reduce load on NFS servers.
Typically has no effect on the local filesystem unless your filesystem
is very very very slow for some reason.
>> 4. Apache's MaxClients directive can now be decided based on the avg
>> response time from the application and what is an acceptable waiting
>> time for the customer. Say,
>> (Avg response time * (MaxClients - 1)) / Concurrency would be =
>> Waiting time for last client in queue .. ?
I don't know for sure, Apache's concurrency settings keep confusing me
so every time I configure it I have to re-read its docs carefully, and
I still wouldn't feel like I fully understand it. :) This is a
question that's best asked to the Apache developers I think.
>> Thanks Hongli! :) Hope im not freaking you out with all the
>> questions! :D
You're welcome.
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl