1

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.

2 Answers 2

1
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.
4
  • 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? Commented Sep 2, 2009 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. Commented Sep 2, 2009 at 16:45
  • whoops, the default MinSpareThreads is 75 NOT 10. Sorry. Commented Sep 2, 2009 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. Commented Sep 3, 2009 at 8:52
0

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.