Graham Dumpleton
graham.dumpleton at gmail.com
Fri Nov 16 17:22:19 EST 2007
Apache will kill of child processes based on exceeding MaxRequestsPerChild. Also, if it has to create additional processes to meet demand, when demand drops off, it randomly kills of processes to drop back to idle state number of processes. Graham On 17/11/2007, Chris Guin <cguin at bbn.com> wrote: > The idea isn't to have multiple processes, but just one - I guess the > big obvious thing I didn't think about was that there's no reason to > have the thread running within the python interpreter started up from > Apache. Since it's already communicating via database messages, I > should just figure out how to separate it from mod_python/Apache-land > and run it stand alone. I wasn't aware that Apache would forcibly > terminate one of its own processes - that would certainly explain the > behavior, although why it would do that in the thick of a lot of > requests isn't obvious to me. > > Thanks for your patience, > Chris > > At 04:51 PM 11/16/2007, you wrote: > >Huh, are you saying that you are creating a listener socket in the > >Apache child process from mod_python. You can't really do this as > >Apache is a multi processor web server and you cant have multiple > >processes creating a listener socket on the same port. Thus all but > >the first Apache child process would fail. When that process gets > >recycled by Apache, none of the other Apache child processes would > >take over and thus no listener anymore. > > > >Graham > > > >On 17/11/2007, Chris Guin <cguin at bbn.com> wrote: > > > I've been working on a custom chat server for Django (using > > > mod_python), but have been hugely frustrated with the behavior of my > > > "listening thread." The thread stops at either the time.sleep() or > > > select.select() call and never returns - usually when a lot of > > > asynchronous requests are being answered by the server, although not > > > always (even with one or two browsers left running over night, the > > > thread will eventually stop). Increasing the frequency of the async > > > requests or increasing the number of browsers raises the chance of > > > stoppage to near certain levels - but there's still a high random > > factor to it. > > > > > > I have guaranteed that there is only one "listening thread" running > > > at any time, and have commented out all database and network accesses > > > (so my listening thread is just printing out debug statements and > > > calling time.sleep() and my AJAX calls only retrieve random > > > numbers). The problem still occurs, and in the same manner. Nor is > > > it a gradual slowdown - time.sleep() takes the correct number of > > > seconds to return right up until the time it fails to return at all. > > > > > > When Apache starts up it says: "mod_python: Creating 8 session > > > mutexes based on 256 max processes and 0 max threads." This looks a > > > little suspicious - is there a mod_python setting that I have > > > incorrect? My understanding of the workings of mod_python is fairly > > > weak, so this may not even the right group to be posting to. > > > > > > Thanks for any help you could give, > > > Chris Guin > > > > > > > > > _______________________________________________ > > > Mod_python mailing list > > > Mod_python at modpython.org > > > http://mailman.modpython.org/mailman/listinfo/mod_python > > > > > >
|