0

In development, I'd like to have changes to my application propagate immediately. "MaxRequestsPerChild 1" restarts each process after a request, but if there are multiple server processes, changes still don't propagate until each process restarts.

I've tried several different directives to limit the number of server processes to 1:

StartServers 1
MinSpareThreads 1
MaxSpareThreads 1
ThreadLimit 1
ThreadsPerChild 1
MaxClients 1
MaxRequestsPerChild 1

Apache still starts with multiple (3) apache2 processes. I'm using the mpm_worker module

1 Answer 1

1

Having those parameters is very counter productive for apache performance, I wouldn't recommend them.

Depending on the language you're developing with you have different mechanisms to ensure a proper load of new code, but in any case the only way to kill all children at the same time would be to restart apache, with that you'll be kicking everyone out so I don't really think you want to do that either.

My recommendation would be to find the best way to reload code depending on what you are running, for example for python you can use mod_wsgi

3
  • I'm using mod_wsgi, and I'm developing, so I'm not worried about performance. I want a solution that reloads the application whenever any change is made. According to code.google.com/p/modwsgi/wiki/ReloadingSourceCode, setting MaxRequestsPerChild 1 seems to be the only option. However, I also need to have only one process running. How can I configure that? Jan 16, 2011 at 23:30
  • 2
    Michael, you haven't read that document properly if the conclusion you came to is that MaxRequestPerChild is the only solution. That solution only applies to embedded mode or Apache's main processes. Use daemon mode of mod_wsgi and delegate your WSGI application to that. You can then setup the code change monitoring described in that document. Using daemon mode also allows you to run the single process you are after. Jan 17, 2011 at 2:59
  • Graham is completely right, that's the right way to do it
    – lynxman
    Jan 17, 2011 at 8:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .