I would like to point out this is simply a multi-process programming issue
not specific to mod_wsgi.  May I suggest that instead of reinventing the
wheel here, just usr a tool designed for this job.

I suggest Redis.  We use it for many similar things in high traffic web
apps and have noted no performance issues.  What you really need is a
master copy of said value and a way to update it when needed.

If not willing to use Redis, then you need to look at other mechanisms of
cross-process communications, or only set the value to last for (example) 2
minutes and update it in each process after that time.

Reatarting a python app is very heavy compared to making a request, so it
should be avoided.

Note that mod_wsgi has options for autorestarting processes after a
specific time.  But again, you would be attacking a board with a dull
handsaw compared to a razor sharp table saw.
 On Jul 1, 2014 8:48 AM, "Ice Prince" <[email protected]> wrote:

> Hello,
> Me again. I'm in satisfaction with my current configuration as quite good
> in performance:
> Apache: prefork with 150 child processed max, wsgi daemon mode:
> processes=6 threads=5
>
> I have a Flask global variable:
>     app.abc = select_db(my_db)
>
> At the beginning (the 1st request) of a process, it takes some time to get
> the value of app.abc cause Database progress, after that, for the sub
> sequence requests of same process, i already have the app.abc in memory to
> serve the threads, so it's really fast to respond.
>
> Now, issue raise when the content in DB is changed and i need to update
> the app.abc but i don't know how to clean app.abc of all processes in the
> memory. Apache reload is solved problem but this is really ugly method,
> touch the wsgi file also not help cause this global var still persist in
> mem.
>
> I also read https://code.google.com/p/modwsgi/wiki/ReloadingSourceCode
> but don't get the point for my situation.
> Please help me for more detail. Thank in advance.
>
> Regard,
> Tuan.
>
>
>  --
> 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 http://groups.google.com/group/modwsgi.
> For more options, visit 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 http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to