What version of mod_wsgi and Apache are you using? Are you stuck with old versions of both?
For memory tracking there are API calls mod_wsgi provides in recent versions for getting memory usage which can be used as part of scheme to trigger a process restart. You can’t use sys.exit(), but can use signals to trigger a clean shutdown of a process. Again better to have recent mod_wsgi versions as can then also set up some graceful timeout options for signal induced restart. Also, what is your mod_wsgi configuration so can make sure doing all the typical things one would do to limit memory usage, or quarantine particular handlers which are memory hungry? Graham > On 17 Mar 2016, at 4:29 AM, Kent Bower <[email protected]> wrote: > > Interesting idea.. yes, we are using multiple threads and also other stack > frameworks, so that's not straightforward, but worth thinking about... not > sure how to approach that with the other threads. Thank you Bill. > > On Wed, Mar 16, 2016 at 1:11 PM, Bill Freeman <[email protected] > <mailto:[email protected]>> wrote: > I don't know about nginx, but one possibility, if the large memory requests > are infrequent, is to detect when you have completed one and trigger the > exit/reload of the daemon process (calling sys.exit() is not the way, since > there could be other threads in the middle of something, unless you run one > thread per process). > > On Wed, Mar 16, 2016 at 7:50 AM, Kent <[email protected] > <mailto:[email protected]>> wrote: > I'm looking for a very brief high-level pros vs. cons of wsgi under apache > vs. under nginx and then to be pointed to more details I can study myself (or > at least the latter). > > Our application occasionally allows requests that consume a large amount of > RAM (no obvious way around that, they are valid requests) and occasionally > this causes problems since we can't reclaim the RAM readily from apache. (We > already have tweaked with and do use "inactivity-timeout". This helps, but > still now and then we hit problems where we run into swapping to disk.) > > I'm wondering if nginx may solve this problem. I've read much of what you > (Graham) have had to say about the memory strategies with apache and > mod_wsgi, but wonder what your opinion of nginx is and where you've already > discussed this. I've read articles I could find you've written on nginx, > such as "Blocking requests and nginx version of mod_wsgi," but wonder if the > same weaknesses are still applicable today, 7 years later? > > > Thank you very much in advance! > Kent > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/modwsgi > <https://groups.google.com/group/modwsgi>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to a topic in the Google > Groups "modwsgi" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/modwsgi/wyo2bJP0Cfc/unsubscribe > <https://groups.google.com/d/topic/modwsgi/wyo2bJP0Cfc/unsubscribe>. > To unsubscribe from this group and all its topics, send an email to > [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/modwsgi > <https://groups.google.com/group/modwsgi>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/modwsgi > <https://groups.google.com/group/modwsgi>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
