On 2/22/2019 2:15 PM, John Dunlap wrote:
The Prefork MPM has the following settings:
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
I see these Apache directives but the documentation states that they
only apply to a threaded mod_perl/Apache which prefork definitely is not:
PerlInterpStart
PerlInterpMax
PerlInterpMinSpare
PerlInterpMaxSpare
PerlInterpMaxRequests
How does mod_perl allocate interpreters to the prefork worker processes?
Is there one perl interpreter for each of preform worker? Is there a
pool of perl interpreters which is smaller than the pool of prefork
workers? Are there settings for configuring the size of the perl
interpreter pool? When a request comes in, does the user have to wait
for a perl interpreter process to start or is there already one waiting
for them?
If you're asking about mod_perl and prefork:
Apache handles child process creation. Each Apache child process loads
the Perl interpreter when it starts and the Perl interpreter persists in
the process till the process terminates. So, at any given time, there're
as many Perl interpreters loaded and ready as there're Apache processes.
When a request comes in, if there's an available Apache process to serve
the request, it's served. If not, Apache will create a new process or
queue the request to be served when a process becomes available.
With the numbers above, your server is able to handle 150 simultaneous
requests. If processes are not busy serving requests, then Apache will
kill idle processes based on (Min|Max)SpareServers of 5,10. For an
overly simple example, if you get 150 requests at 8:30 am, the server
could create 145 processes to meet demand. However, if not busy at 8:31
am, when everyone has stepped away for coffee, your process count could
be down near 10. When the boss comes in at 10am and it's back to work,
the server will create 140 new ... at 10:01am, it's down to 10 again.
Generally, with mod_perl, you don't want Apache to kill idle processes
but want them to be around, ready to handle new requests. For maximum
performance, (Min|Max)SpareServers could be as high as your
MaxRequestWorkers. Of course, all of this depends on your RAM, CPU
utilization etc. and you should be able to find a happy medium as you
tweak the numbers.
--
John Dunlap
/CTO | Lariat/
/
/
/*Direct:*/
/j...@lariat.co <mailto:j...@lariat.co>/
/
*Customer Service:*/
877.268.6667
supp...@lariat.co <mailto:supp...@lariat.co>