On 20 September 2011 06:00, Kent <[email protected]> wrote: > A tangentially related question: I've noticed from log files that in > multithreaded mode, the MainThread never does any "work" or is never > fed requests. MainThread only starts the app and only Dummy threads > get work (requests). Is this expected behavior? > > (It kind of means there is no point to threads=2, I guess, right?)
Having 'threads=2' means there will be 2 threads handling requests. These are separate to the main thread, with the main thread after startup merely sitting there monitoring for process shutdown triggers. The 2 threads show as Dummy as that is how Python marks a thread which was create outside of Python and merely call into Python, what it calls an external thread. For daemon mode mod_wsgi creates another 2 special background threads checking for Python deadlocks and process liveness. Whether threads=2 is appropriate or threads=1 is better depends on whether your code is thread safe. If not thread safe, use threads=1. If is thread safe, no problem with threads=2. Graham > On Sep 16, 5:00 pm, Graham Dumpleton <[email protected]> > wrote: >> On 16 September 2011 23:44, Kent <[email protected]> wrote: >> >> > Is there a way to force a delay (arbitrary or determined) so that when >> > apache restarts, it waits until the python app has loaded completely >> > before allowing requests to be taken by the process? >> >> > Our application stems from a turbogears project. When I restart >> > apache it takes a few seconds for the application to load fully and if >> > I send an http request within the first several seconds after the >> > restart, then not only does the request fail, but all the subsequent >> > requests to the application (or at least that process) fail as well. >> >> > Any advise? >> >> Describe what you mean by request fails, providing any error messages >> from browser or Apache error logs. >> >> There are ways of preloading on process start, but I can't see how >> that will make a difference because even with lazy loading no request >> is allowed into your application until it is finished loading. >> >> There must be something else going on that is causing the problem so >> please provide more details. >> >> I will explain how to do preloading, but will need to be later. >> >> Graham > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
