Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently switched from Apache 2.2 prefork to Apache 2.2 worker, but I have no idea what would be a great MPM config to start with. On prefork, I used :
MaxClients 256
StartServers 190
MinSpareServers 160
MaxSpareServers 220

I'd like to be able to accept at least as much simultaneous requests (190)

Thanks !

PS: Server environment: Debian 5.0, 2x 3.00 Ghz, 4 GB RAM, dedicated to Apache.

share|improve this question

2 Answers 2

ServerLimit 256
MaxClients 256
StartServers 19
ThreadsPerChild 10
MinSpareThreads 160
MaxSpareThreads 220
MaxRequestsPerChild 10000

This will:

  • Start 190 threads when httpd starts
  • Serve up to 256 simultaneous requests
  • Ensure a min of 160 spare threads
  • Limit a max of 220 spare threads
  • Limit each httpd child process to serving 10,000 requests before replacing it with a new child process. This helps prevent hanging up the apache server in case there are memory leaks in the underlying application.
share|improve this answer
    
I'm no Apache expert, but from httpd.apache.org/docs/2.2/mod/worker.html I take it that "MaxClients 256" limits to 256 threads in total. Shouldn't that be higher when a "MinSpareThreads 160" is also enforced. Could your config not be more robust by using fewer parameters and letting Apaches default auto-tuning take care of the rest? –  Jesper Mortensen Sep 2 '09 at 16:28
    
jesper makes a good point. The default vaules for those directives are better than what you were using with prefork and the ones I mentioned. The only directive you might want to use is the 'MinSpareThreads 160' as the default is 10. Definitely read the link jesper mentioned as well as httpd.apache.org/docs/2.2/mod/mpm_common.html to help you make the best decision on how to set these directives. –  Sean Staats Sep 2 '09 at 16:45
    
whoops, the default MinSpareThreads is 75 NOT 10. Sorry. –  Sean Staats Sep 2 '09 at 16:46
    
Thank you for your advice. I set : StartServers 8 MaxClients 1024 MinSpareThreads 512 MaxSpareThreads 1024 ThreadsPerChild 64 MaxRequestsPerChild 10000 I chose greater values since the memory footprint is supposed to be much smaller. I noticed too that when running apachectl configtest (or start/stop) with weird values, it reports the error and auto adjusts the settings. –  Julien Tartarin Sep 3 '09 at 8:52
up vote 0 down vote accepted

Finally, I used the following settings which are working pretty well :

StartServers 8
MaxClients 1024
MinSpareThreads 512
MaxSpareThreads 1024
ThreadsPerChild 64
MaxRequestsPerChild 10000

I chose greater values since the memory footprint is supposed to be much smaller. I noticed too that when running apachectl configtest (or start/stop) with weird values, it reports the error and auto adjusts the settings.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.