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.
--
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 modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
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.
Add potentially graceful process restart option for daemon processeswhen sent a graceful restart signal. Signal is usually ``SIGUSR1`` but isplatform dependent as using same signal as Apache would use. If the``graceful-timeout`` option had been provided to ``WSGIDaemonProcess``,then the process will attempt graceful shutdown first based on thattimeout, otherwise normal shutdown procedure used as if received a``SIGTERM``.
--
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/6v3JSrNYUhA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.